mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Merge branch '1454-theme-system-crash' into 'master'
Prevent crash when user has set theme to system default on unsupported API level Closes #1454 See merge request briar/briar!1191
This commit is contained in:
@@ -218,11 +218,17 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (SDK_INT < 27) {
|
if (SDK_INT < 27) {
|
||||||
// remove System Default Theme option
|
// remove System Default Theme option from preference entries
|
||||||
|
// as it is not functional on this API anyway
|
||||||
List<CharSequence> entries =
|
List<CharSequence> entries =
|
||||||
new ArrayList<>(Arrays.asList(theme.getEntries()));
|
new ArrayList<>(Arrays.asList(theme.getEntries()));
|
||||||
entries.remove(getString(R.string.pref_theme_system));
|
entries.remove(getString(R.string.pref_theme_system));
|
||||||
theme.setEntries(entries.toArray(new CharSequence[0]));
|
theme.setEntries(entries.toArray(new CharSequence[0]));
|
||||||
|
// also remove corresponding value
|
||||||
|
List<CharSequence> values =
|
||||||
|
new ArrayList<>(Arrays.asList(theme.getEntryValues()));
|
||||||
|
values.remove(getString(R.string.pref_theme_system_value));
|
||||||
|
theme.setEntryValues(values.toArray(new CharSequence[0]));
|
||||||
}
|
}
|
||||||
if (IS_DEBUG_BUILD) {
|
if (IS_DEBUG_BUILD) {
|
||||||
findPreference("pref_key_explode").setOnPreferenceClickListener(
|
findPreference("pref_key_explode").setOnPreferenceClickListener(
|
||||||
|
|||||||
Reference in New Issue
Block a user