Query the current SDK version to avoid complications when setting the switches in older versions.
This commit is contained in:
ErikWaegerle 2020-07-07 18:15:49 +02:00
parent 9982c9f592
commit e25da314ff

View file

@ -217,6 +217,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
PreferenceManager preferenceManager = getPreferenceManager(); PreferenceManager preferenceManager = getPreferenceManager();
SharedPreferences sp = preferenceManager.getSharedPreferences(); SharedPreferences sp = preferenceManager.getSharedPreferences();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (sp.getBoolean("pref_dark_mode_setting", false)) { if (sp.getBoolean("pref_dark_mode_setting", false)) {
//TwoStatePreference x = (TwoStatePreference) findPreference("pref_dark_mode_automatically_by_system"); //TwoStatePreference x = (TwoStatePreference) findPreference("pref_dark_mode_automatically_by_system");
@ -238,6 +239,8 @@ 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();