From e832e6c4ac9664b27e209e1585e5ea7eb0722334 Mon Sep 17 00:00:00 2001 From: ErikWaegerle Date: Mon, 29 Jun 2020 15:33:10 +0200 Subject: [PATCH] Adjustment of the MainActivity, so that DarkTheme is still active with the activated battery or system status option. Dark Theme will remain if the app is closed. --- .../privacyfriendlysudoku/ui/MainActivity.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index e25b7b5..7973ad6 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -2,6 +2,7 @@ package org.secuso.privacyfriendlysudoku.ui; import android.content.Intent; import android.content.SharedPreferences; +import android.media.audiofx.Equalizer; import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; @@ -60,11 +61,17 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig settings = PreferenceManager.getDefaultSharedPreferences(this); - if (settings.getBoolean("pref_dark_mode_setting", false )) { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - } else { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - } + if (settings.getBoolean("pref_dark_mode_setting", false )) { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + + } else if (settings.getBoolean("pref_dark_mode_automatically_by_system", false)) { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); + + } else if(settings.getBoolean("pref_dark_mode_automatically_by_battery", false)){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY); + } else { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + } NewLevelManager newLevelManager = NewLevelManager.getInstance(getApplicationContext(), settings);