Adaptation of the GameActivity

Dark Theme remains activated
In case the GameActivity is loaded first by clicking a sudoku:// link
This commit is contained in:
ErikWaegerle 2020-06-24 18:47:01 +02:00
parent 73e7fa3958
commit 50f7260717

View file

@ -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);
}