//夜间白天
int mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
SharedPreferences sp = getSharedPreferences("night", Context.MODE_PRIVATE);
if (mode == Configuration.UI_MODE_NIGHT_YES) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", false).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else if (mode == Configuration.UI_MODE_NIGHT_NO) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", true).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
int mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
SharedPreferences sp = getSharedPreferences("night", Context.MODE_PRIVATE);
if (mode == Configuration.UI_MODE_NIGHT_YES) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", false).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else if (mode == Configuration.UI_MODE_NIGHT_NO) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", true).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}