Disabling night theme selection if auto theme is not used

This commit is contained in:
Jared Fantaye 2022-12-01 13:01:58 +01:00
parent aad5e26f31
commit a2f2d562f6
2 changed files with 7 additions and 8 deletions

View File

@ -44,7 +44,12 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment {
return false; return false;
}); });
} else { } else {
removePreference(nightThemeKey); // disable the night theme selection
final Preference preference = findPreference(nightThemeKey);
if (preference != null) {
preference.setEnabled(false);
preference.setSummary(getString(R.string.night_theme_available));
}
} }
} }
@ -61,13 +66,6 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment {
return super.onPreferenceTreeClick(preference); return super.onPreferenceTreeClick(preference);
} }
private void removePreference(final String preferenceKey) {
final Preference preference = findPreference(preferenceKey);
if (preference != null) {
getPreferenceScreen().removePreference(preference);
}
}
private void applyThemeChange(final String beginningThemeKey, private void applyThemeChange(final String beginningThemeKey,
final String themeKey, final String themeKey,
final Object newValue) { final Object newValue) {

View File

@ -714,6 +714,7 @@
<string name="auto_device_theme_title">Automatic (device theme)</string> <string name="auto_device_theme_title">Automatic (device theme)</string>
<string name="night_theme_summary">Select your favorite night theme — %s</string> <string name="night_theme_summary">Select your favorite night theme — %s</string>
<string name="select_night_theme_toast">You can select your favorite night theme below</string> <string name="select_night_theme_toast">You can select your favorite night theme below</string>
<string name="night_theme_available">This option is only available if Automatic (Device Theme) is selected for Theme</string>
<string name="download_has_started">Download has started</string> <string name="download_has_started">Download has started</string>
<string name="description_select_note">You can now select text inside the description. Note that the page may flicker and links may not be clickable while in selection mode.</string> <string name="description_select_note">You can now select text inside the description. Note that the page may flicker and links may not be clickable while in selection mode.</string>
<string name="description_select_enable">Enable selecting text in the description</string> <string name="description_select_enable">Enable selecting text in the description</string>