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.

This commit is contained in:
ErikWaegerle 2020-06-29 15:33:10 +02:00
parent 38a708821a
commit e832e6c4ac

View file

@ -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;
@ -62,6 +63,12 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
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);
}