From 67e73a61751d8fa33bcb5993c0930f32d871e6c6 Mon Sep 17 00:00:00 2001 From: ErikWaegerle Date: Wed, 29 Jul 2020 19:54:59 +0200 Subject: [PATCH] Adjusting the SettingsActivity Here it is checked whether the battery and system have the value true at the same time. In this case the Battery value is set to false to solve the problem that both options can have the same value. --- .../org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java index f749e46..63e379e 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java @@ -90,6 +90,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { public void restartActivity() { Intent i = new Intent(getApplicationContext(), MainActivity.class); + recreate(); finish(); startActivity(i); } @@ -225,6 +226,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity { findPreference("pref_dark_mode_automatically_by_system").setEnabled(false); findPreference("pref_dark_mode_automatically_by_battery").setEnabled(false); } else { + if (sp.getBoolean("pref_dark_mode_automatically_by_battery", false) && sp.getBoolean("pref_dark_mode_automatically_by_system", false) ) { + sp.edit().putBoolean("pref_dark_mode_automatically_by_battery", false).commit(); + } findPreference("pref_dark_mode_automatically_by_system").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_battery", false)); findPreference("pref_dark_mode_automatically_by_battery").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_system", false));