Adaptation of the GamePreferenceFragment class
Modify the switches in the SettingsActivity If Dark Theme has been set manually, Dark Theme is displayed greyed out according to battery and system. Additionally it is only allowed to set one of both to the Dark theme, not both at the same time.
This commit is contained in:
parent
d1615b4f5f
commit
9982c9f592
1 changed files with 16 additions and 1 deletions
|
@ -213,6 +213,22 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||||
addPreferencesFromResource(R.xml.pref_settings_general);
|
addPreferencesFromResource(R.xml.pref_settings_general);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
|
||||||
|
PreferenceManager preferenceManager = getPreferenceManager();
|
||||||
|
SharedPreferences sp = preferenceManager.getSharedPreferences();
|
||||||
|
|
||||||
|
|
||||||
|
if (sp.getBoolean("pref_dark_mode_setting", false)) {
|
||||||
|
//TwoStatePreference x = (TwoStatePreference) findPreference("pref_dark_mode_automatically_by_system");
|
||||||
|
//x.setEnabled(false);
|
||||||
|
findPreference("pref_dark_mode_automatically_by_system").setEnabled(false);
|
||||||
|
findPreference("pref_dark_mode_automatically_by_battery").setEnabled(false);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
findPreference("pref_dark_mode_automatically_by_system").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_battery", false));
|
||||||
|
findPreference("pref_dark_mode_automatically_by_battery").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_system", false));
|
||||||
|
}
|
||||||
|
|
||||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||||
// to their values. When their values change, their summaries are
|
// to their values. When their values change, their summaries are
|
||||||
// updated to reflect the new value, per the Android Design
|
// updated to reflect the new value, per the Android Design
|
||||||
|
@ -222,7 +238,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||||
//bindPreferenceSummaryToValue(findPreference("example_list"));
|
//bindPreferenceSummaryToValue(findPreference("example_list"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
Loading…
Reference in a new issue