Skip to content

Commit fcac53c

Browse files
authored
Merge pull request TeamNewPipe#9488 from Jared234/9353_night_theme_selection
Disabling night theme selection if auto theme is not used
2 parents b07f1a7 + 5fc85fa commit fcac53c

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

app/src/main/java/org/schabi/newpipe/settings/AppearanceSettingsFragment.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro
4444
return false;
4545
});
4646
} else {
47-
removePreference(nightThemeKey);
47+
// disable the night theme selection
48+
final Preference preference = findPreference(nightThemeKey);
49+
if (preference != null) {
50+
preference.setEnabled(false);
51+
preference.setSummary(getString(R.string.night_theme_available,
52+
getString(R.string.auto_device_theme_title)));
53+
}
4854
}
4955
}
5056

@@ -61,13 +67,6 @@ public boolean onPreferenceTreeClick(final Preference preference) {
6167
return super.onPreferenceTreeClick(preference);
6268
}
6369

64-
private void removePreference(final String preferenceKey) {
65-
final Preference preference = findPreference(preferenceKey);
66-
if (preference != null) {
67-
getPreferenceScreen().removePreference(preference);
68-
}
69-
}
70-
7170
private void applyThemeChange(final String beginningThemeKey,
7271
final String themeKey,
7372
final Object newValue) {

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@
716716
<string name="auto_device_theme_title">Automatic (device theme)</string>
717717
<string name="night_theme_summary">Select your favorite night theme — %s</string>
718718
<string name="select_night_theme_toast">You can select your favorite night theme below</string>
719+
<string name="night_theme_available">This option is only available if %s is selected for Theme</string>
719720
<string name="download_has_started">Download has started</string>
720721
<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>
721722
<string name="description_select_enable">Enable selecting text in the description</string>

0 commit comments

Comments
 (0)