fix(YouTube - Settings): Correctly initialize default values

This commit is contained in:
LisoUseInAIKyrios 2024-01-06 21:28:41 +04:00
parent 9920116f63
commit 752544b962
2 changed files with 3 additions and 3 deletions

View File

@ -164,7 +164,7 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
} else if (pref instanceof EditTextPreference) { } else if (pref instanceof EditTextPreference) {
EditTextPreference editPreference = (EditTextPreference) pref; EditTextPreference editPreference = (EditTextPreference) pref;
if (applySettingToPreference) { if (applySettingToPreference) {
editPreference.getEditText().setText(setting.get().toString()); editPreference.setText(setting.get().toString());
} else { } else {
Setting.privateSetValueFromString(setting, editPreference.getText()); Setting.privateSetValueFromString(setting, editPreference.getText());
} }

View File

@ -14,12 +14,12 @@ import app.revanced.integrations.youtube.settings.Settings;
public class ReVancedPreferenceFragment extends AbstractPreferenceFragment { public class ReVancedPreferenceFragment extends AbstractPreferenceFragment {
@Override @Override
protected void initialize() { protected void initialize() {
super.initialize();
// If the preference was included, then initialize it based on the available playback speed // If the preference was included, then initialize it based on the available playback speed
Preference defaultSpeedPreference = findPreference(Settings.PLAYBACK_SPEED_DEFAULT.key); Preference defaultSpeedPreference = findPreference(Settings.PLAYBACK_SPEED_DEFAULT.key);
if (defaultSpeedPreference instanceof ListPreference) { if (defaultSpeedPreference instanceof ListPreference) {
CustomPlaybackSpeedPatch.initializeListPreference((ListPreference) defaultSpeedPreference); CustomPlaybackSpeedPatch.initializeListPreference((ListPreference) defaultSpeedPreference);
} }
super.initialize();
} }
} }