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

Commit a992b611 authored by ryanlwlin's avatar ryanlwlin Committed by Ryan Lin
Browse files

Fix incorrect UI after triple-tap is disabled

The preference summary is not changed after
users disable the triple tap shortcut by the confirm
dialog. It is due to the fact that the fragment doesn't
observe the settings value change.

To fix it, we add the settings key to observe the change.

Bug: 208755360
Test: manual test
Change-Id: Ie5b7fc5e67c5491b53485af0d3d68d1789aeace4
parent 395ea90b
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -143,9 +143,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
            setPreferenceScreen(preferenceScreen);
        }

        final List<String> shortcutFeatureKeys = new ArrayList<>();
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
        final List<String> shortcutFeatureKeys = getFeatureSettingsKeys();
        mSettingsContentObserver = new SettingsContentObserver(new Handler(), shortcutFeatureKeys) {
            @Override
            public void onChange(boolean selfChange, Uri uri) {
@@ -155,6 +153,13 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
        };
    }

    protected List<String> getFeatureSettingsKeys() {
        final List<String> shortcutFeatureKeys = new ArrayList<>();
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
        return shortcutFeatureKeys;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
+7 −0
Original line number Diff line number Diff line
@@ -275,6 +275,13 @@ public class ToggleScreenMagnificationPreferenceFragment extends
        return context.getText(resId);
    }

    @Override
    protected List<String> getFeatureSettingsKeys() {
        final List<String> shortcutKeys = super.getFeatureSettingsKeys();
        shortcutKeys.add(Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED);
        return shortcutKeys;
    }

    @Override
    protected CharSequence getShortcutTypeSummary(Context context) {
        if (!mShortcutPreference.isChecked()) {