Fix quick settings tooltip changed when color correction fab clicked
Root cause: Users click on color correction fab to make foreground activity recreate. When recreated, the ag/13472947 makes the MainSwitch updates to ON status and get the callback for #onPreferenceToggled. It pops up the direct-use style tooltip rather than the edit style tooltip. Soluton: Reference #updateSwitchBarToggleSwitch to early returns if values are same. Bug: 229167631 Test: Manual testing Change-Id: I6781fd509db7538898ad6ff0ae47124c9b9e1bc5
This commit is contained in:
@@ -51,6 +51,11 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
||||
|
||||
@Override
|
||||
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
||||
final boolean isEnabled = Settings.Secure.getInt(getContentResolver(), ENABLED, OFF) == ON;
|
||||
if (enabled == isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
|
||||
}
|
||||
|
@@ -166,6 +166,11 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
|
||||
|
||||
@Override
|
||||
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
||||
final boolean isEnabled = Settings.Secure.getInt(getContentResolver(), ENABLED, OFF) == ON;
|
||||
if (enabled == isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user