Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9e6e8c8 authored by menghanli's avatar menghanli
Browse files

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
parent 361d42af
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);
        }
+5 −0
Original line number Diff line number Diff line
@@ -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);
        }