diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index 80b9bf4..6a504e8 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -17,6 +17,8 @@ import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import com.google.android.material.navigation.NavigationView; + +import androidx.appcompat.app.AppCompatDelegate; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.appcompat.app.ActionBarDrawerToggle; @@ -96,6 +98,12 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); + if (sharedPref.getBoolean("pref_dark_mode_setting", false )) { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + } else { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + } + if(sharedPref.getBoolean("pref_keep_screen_on", true)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }