Add the settings content observer for shortcut preference.

Root cause:
Didn't update the UI when settings value chagned.

Next:
Add the settings content observer.

Bug: 155837154
Test: manual test
Change-Id: Icee0bb50f88987ea6c8a0be59bd936628a32ca1e
This commit is contained in:
Peter_Liang
2020-05-12 14:10:21 +08:00
parent 9454ab07a8
commit 785af0c15a
2 changed files with 21 additions and 4 deletions

View File

@@ -467,7 +467,8 @@ public class ToggleScreenMagnificationPreferenceFragment extends
showDialog(DialogEnums.MAGNIFICATION_EDIT_SHORTCUT);
}
private void updateShortcutPreferenceData() {
@Override
protected void updateShortcutPreferenceData() {
// Get the user shortcut type from settings provider.
mUserShortcutType = getUserShortcutTypeFromSettings(getPrefContext());
if (mUserShortcutType != UserShortcutType.EMPTY) {
@@ -489,7 +490,8 @@ public class ToggleScreenMagnificationPreferenceFragment extends
mShortcutPreference.setTitle(title);
}
private void updateShortcutPreference() {
@Override
protected void updateShortcutPreference() {
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
mShortcutPreference.setChecked(
hasMagnificationValuesInSettings(getPrefContext(), shortcutTypes));