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
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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()) {
|
||||
|
Reference in New Issue
Block a user