Adaptation of the MainActivity
is loaded in Main Activity, that the dark theme remains activated when the app is opened again
This commit is contained in:
parent
1106ee84bb
commit
73e7fa3958
1 changed files with 10 additions and 0 deletions
|
@ -6,6 +6,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.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
|
@ -54,8 +56,16 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
NewLevelManager newLevelManager = NewLevelManager.getInstance(getApplicationContext(), settings);
|
||||
|
||||
// check if we need to pre generate levels.
|
||||
|
|
Loading…
Reference in a new issue