Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:8.13.0'
classpath 'com.apollographql.apollo:apollo-gradle-plugin:2.5.14'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
3 changes: 2 additions & 1 deletion claimManagement/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ android {
demoProd {
applicationIdSuffix ".demoProd"
resValue "string", "app_name_claims", "Claims Demo"
buildConfigField "String", "API_BASE_URL", '"http://demo.openimis.org/"'
buildConfigField "String", "API_BASE_URL", '"https://demo.openimis.org/"'
dimension 'std'
}

Expand Down Expand Up @@ -180,6 +180,7 @@ android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
namespace 'org.openimis.imisclaims'
}

apollo {
Expand Down
3 changes: 1 addition & 2 deletions claimManagement/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.openimis.imisclaims">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down
20 changes: 20 additions & 0 deletions claimManagement/src/main/java/org/openimis/imisclaims/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@

import static org.openimis.imisclaims.BuildConfig.RAR_PASSWORD;

import androidx.appcompat.app.AppCompatDelegate;

import org.openimis.imisclaims.tools.Log;

public class Global extends Application {
private static final String SHPREF_NAME = "SHPref";
private static final String SHPREF_LANGUAGE = "language";
private static final String SHPREF_DARK_MODE = "night";
private static final String DEFAULT_LANGUAGE_CODE = "en";
private static final String SHPREF_CSRF = "csrfToken";
private static Global instance;
Expand Down Expand Up @@ -330,4 +333,21 @@ public void setSavedLanguage(String languageCode) {
editor.putString(SHPREF_LANGUAGE, languageCode);
editor.apply();
}

public void getDarkMode () {
SharedPreferences sp = getDefaultSharedPreferences();
boolean dark_mode = sp.getBoolean(SHPREF_DARK_MODE, false);
if(dark_mode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
}

public void setDarkMode(boolean darkMode){
SharedPreferences sp = getDefaultSharedPreferences();
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean(SHPREF_DARK_MODE, darkMode);
editor.apply();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ protected void onCreate(Bundle savedInstanceState) {
entered_Count.setText("0");

AdminName = findViewById(R.id.AdminName);
global.getDarkMode();

if (checkRequirements()) {
onAllRequirementsMet();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package org.openimis.imisclaims;

import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Base64;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Switch;

import androidx.appcompat.app.AppCompatDelegate;

import java.security.MessageDigest;
import java.security.SecureRandom;
Expand All @@ -21,6 +27,11 @@ public class SettingsActivity extends ImisActivity {
private String salt, password;
public static String generatedSalt;
Global global;
private Switch mode_switch;
SharedPreferences sharedPreferences;
SharedPreferences.Editor editor;
private static final String SHPREF_NAME = "SHPref";
boolean dark_mode;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -32,6 +43,15 @@ protected void onCreate(Bundle savedInstanceState) {
btnSaveRarPwd = (Button)findViewById(R.id.btnSaveRarPwd);
etRarPassword = (EditText)findViewById(R.id.rarPassword);
btnDefaultRarPassword = (Button) findViewById(R.id.btnDefaultRarPassword);
mode_switch = findViewById(R.id.mode_switch);
global = (Global) getApplicationContext();

sharedPreferences = getSharedPreferences(SHPREF_NAME, Context.MODE_PRIVATE);
dark_mode = sharedPreferences.getBoolean("night", false);

if(dark_mode){
mode_switch.setChecked(true);
}

btnSaveRarPwd.setOnClickListener(view -> {
if(etRarPassword.getText().length() == 0){
Expand All @@ -52,6 +72,19 @@ protected void onCreate(Bundle savedInstanceState) {
ShowDialog("Password has been changed to the default rar password");
});

mode_switch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(dark_mode){
global.setDarkMode(false);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else {
global.setDarkMode(true);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
}
});

}

public static String getGeneratedSalt() {
Expand Down
2 changes: 1 addition & 1 deletion claimManagement/src/main/res/drawable-v24/corner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<stroke android:width="1dp"
android:color="@color/grey2"/>
<corners android:radius="2dp"/>
<solid android:color="@color/white" />
<solid android:color="@color/edit_text_color" />
</shape>
2 changes: 1 addition & 1 deletion claimManagement/src/main/res/drawable/corner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<stroke android:width="1dp"
android:color="@color/grey2"/>
<corners android:radius="2dp"/>
<solid android:color="@color/white" />
<solid android:color="@color/edit_text_color" />
</shape>
6 changes: 3 additions & 3 deletions claimManagement/src/main/res/drawable/side_nav_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
android:shape="rectangle">
<gradient
android:angle="135"
android:centerColor="#031f3e"
android:endColor="#00001b"
android:startColor="#323570"
android:centerColor="#006273"
android:endColor="#006273"
android:startColor="#00323A"
android:type="linear" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:layout_alignParentStart="true"
android:layout_marginTop="@dimen/text_margin"
android:layout_marginStart="@dimen/text_margin"
android:textColor="@color/white"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size_header">

</TextView>
Expand All @@ -35,7 +35,7 @@
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/text_margin"
android:layout_marginTop="@dimen/text_margin"
android:textColor="@color/white"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size_header">

</TextView>
Expand All @@ -56,7 +56,7 @@
android:layout_alignParentStart="true"
android:layout_marginBottom="@dimen/text_margin"
android:layout_marginStart="@dimen/text_margin"
android:textColor="@color/white"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size_content">

</TextView>
Expand All @@ -68,7 +68,7 @@
android:layout_alignParentEnd="true"
android:layout_marginBottom="@dimen/text_margin"
android:layout_marginEnd="@dimen/text_margin"
android:textColor="@color/white"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size_content">

</TextView>
Expand Down
26 changes: 26 additions & 0 deletions claimManagement/src/main/res/layout/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,30 @@
android:text="@string/SaveRarPassword" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/DarkMode"
android:textColor="@color/Black"
android:textSize="20sp"
android:fontFamily="sans-serif-light"/>

<Switch
android:id="@+id/mode_switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:textSize="20sp"/>

</LinearLayout>



</LinearLayout>
29 changes: 29 additions & 0 deletions claimManagement/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<color name="colorPrimary">#006273</color>
<color name="colorPrimaryDark">#00525F</color>
<color name="colorAccent">#ececec</color>
<color name="colorAccent2">#FF4081</color>
<color name="grey2">#747474</color>
<color name="white">#121212</color>
<color name="faint">#ececec</color>


<color name="Green">#00ff00</color>
<color name="Green2">#00c600</color>
<color name="Orange">#FFA500</color>
<color name="Orange2">#ffbe48</color>
<color name="yellow">#f7de04</color>
<color name="Red">#000</color>
<color name="Black">#FFFFFF</color>
<color name="Blue">#d5cf4200</color>
<color name="White">#000000</color>
<color name="Gray">#8C8C8C</color>
<color name="blue">#ececec</color>
<color name="colorPrimary2">#121248</color>
<color name="edit_text_color">#373737</color>
<color name="text_color">#ececec</color>


</resources>
26 changes: 26 additions & 0 deletions claimManagement/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<style name="CustomTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
8 changes: 5 additions & 3 deletions claimManagement/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#090925</color>
<color name="colorPrimaryDark">#080c21</color>
<color name="colorAccent">#080c21</color>
<color name="colorPrimary">#006273</color>
<color name="colorPrimaryDark">#00525F</color>
<color name="colorAccent">#006273</color>
<color name="colorAccent2">#FF4081</color>
<color name="grey2">#747474</color>
<color name="white">#ffffff</color>
Expand All @@ -22,6 +22,8 @@
<color name="Gray">#404040</color>
<color name="blue">#00197c</color>
<color name="colorPrimary2">#121248</color>
<color name="edit_text_color">#ececec</color>
<color name="text_color">#ececec</color>


</resources>
1 change: 1 addition & 0 deletions claimManagement/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,5 @@
<string name="NoServicesPricelist">This healthfacility don\'t have services pricelist</string>
<string name="NoItemsPricelist">This healthfacility don\'t have items pricelist</string>
<string name="News">New changes:</string>
<string name="DarkMode">Dark mode</string>
</resources>
24 changes: 0 additions & 24 deletions claimManagement/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<style name="CustomTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
28 changes: 28 additions & 0 deletions claimManagement/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<style name="CustomTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>


</resources>
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
Loading