The string of "Hearing device shortcut" is displayed wrong when shortcut set to gesture.
Root Cause: Did not update dialog when user back to previous page. Solution: Merge the solution in ToggleFeaturePreferenceFragment.java Bug: 263451053 Test: manual test Change-Id: I99513fa70cf44b32a0fb78a5f953e41373e086f4
This commit is contained in:
@@ -66,6 +66,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
protected int mSavedCheckBoxValue = NOT_SET;
|
||||
|
||||
protected ShortcutPreference mShortcutPreference;
|
||||
protected Dialog mDialog;
|
||||
private AccessibilityManager.TouchExplorationStateChangeListener
|
||||
mTouchExplorationStateChangeListener;
|
||||
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||
@@ -167,12 +168,15 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||
AccessibilityManager.class);
|
||||
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||
mSettingsContentObserver.register(getContentResolver());
|
||||
updateShortcutPreferenceData();
|
||||
updateShortcutPreference();
|
||||
|
||||
updateEditShortcutDialogIfNeeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,31 +204,30 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int dialogId) {
|
||||
final Dialog dialog;
|
||||
switch (dialogId) {
|
||||
case DialogEnums.EDIT_SHORTCUT:
|
||||
final int dialogType = WizardManagerHelper.isAnySetupWizard(getIntent())
|
||||
? AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC_SUW :
|
||||
AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC;
|
||||
dialog = AccessibilityDialogUtils.showEditShortcutDialog(
|
||||
mDialog = AccessibilityDialogUtils.showEditShortcutDialog(
|
||||
getPrefContext(), dialogType, getShortcutTitle(),
|
||||
this::callOnAlertDialogCheckboxClicked);
|
||||
setupEditShortcutDialog(dialog);
|
||||
return dialog;
|
||||
setupEditShortcutDialog(mDialog);
|
||||
return mDialog;
|
||||
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
||||
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||
dialog = AccessibilityGestureNavigationTutorial
|
||||
mDialog = AccessibilityGestureNavigationTutorial
|
||||
.createAccessibilityTutorialDialogForSetupWizard(
|
||||
getPrefContext(), getUserShortcutTypes(),
|
||||
this::callOnTutorialDialogButtonClicked);
|
||||
} else {
|
||||
dialog = AccessibilityGestureNavigationTutorial
|
||||
mDialog = AccessibilityGestureNavigationTutorial
|
||||
.createAccessibilityTutorialDialog(
|
||||
getPrefContext(), getUserShortcutTypes(),
|
||||
this::callOnTutorialDialogButtonClicked);
|
||||
}
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
return dialog;
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
return mDialog;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
|
||||
}
|
||||
@@ -368,6 +371,13 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
getPreferenceScreen().addPreference(generalCategory);
|
||||
}
|
||||
|
||||
private void updateEditShortcutDialogIfNeeded() {
|
||||
if (mDialog == null || !mDialog.isShowing()) {
|
||||
return;
|
||||
}
|
||||
AccessibilityDialogUtils.updateShortcutInDialog(getContext(), mDialog);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void saveNonEmptyUserShortcutType(int type) {
|
||||
if (type == AccessibilityUtil.UserShortcutType.EMPTY) {
|
||||
|
@@ -120,7 +120,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
||||
private boolean mNeedsQSTooltipReshow = false;
|
||||
private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
|
||||
private boolean mSavedAccessibilityFloatingMenuEnabled;
|
||||
private ImageView mImageGetterCacheView;
|
||||
protected final Html.ImageGetter mImageGetter = (String str) -> {
|
||||
if (str != null && str.startsWith(IMG_PREFIX)) {
|
||||
@@ -276,8 +275,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
AccessibilityManager.class);
|
||||
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||
mSettingsContentObserver.unregister(getContentResolver());
|
||||
mSavedAccessibilityFloatingMenuEnabled = AccessibilityUtil.isFloatingMenuEnabled(
|
||||
getContext());
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user