fix(youtube/settings): fix dialog not shown if dismissed with back button

This commit is contained in:
LisoUseInAIKyrios 2023-04-06 01:28:12 +04:00 committed by oSumAtrIX
parent a0ad968aaa
commit 584de16236
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -32,7 +32,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
/** /**
* If a dialog is currently being shown. Used to prevent showing additional dialogs if user cancels a dialog. * If a dialog is currently being shown. Used to prevent showing additional dialogs if user cancels a dialog.
*/ */
private static boolean currentlyShowingDialog; private boolean currentlyShowingDialog;
SharedPreferences.OnSharedPreferenceChangeListener listener = (sharedPreferences, str) -> { SharedPreferences.OnSharedPreferenceChangeListener listener = (sharedPreferences, str) -> {
try { try {
@ -136,6 +136,9 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
}) })
.setNegativeButton(negativeButton, (dialog, id) -> { .setNegativeButton(negativeButton, (dialog, id) -> {
currentlyShowingDialog = false; currentlyShowingDialog = false;
})
.setOnDismissListener((dialog) -> {
currentlyShowingDialog = false;
}).show(); }).show();
} }
@ -156,7 +159,9 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
SettingsEnum.setValue(setting, defaultBooleanValue); SettingsEnum.setValue(setting, defaultBooleanValue);
switchPref.setChecked(defaultBooleanValue); switchPref.setChecked(defaultBooleanValue);
currentlyShowingDialog = false; currentlyShowingDialog = false;
})
.setOnDismissListener((dialog) -> {
currentlyShowingDialog = false;
}).show(); }).show();
} }
} }