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 int mSavedCheckBoxValue = NOT_SET;
|
||||||
|
|
||||||
protected ShortcutPreference mShortcutPreference;
|
protected ShortcutPreference mShortcutPreference;
|
||||||
|
protected Dialog mDialog;
|
||||||
private AccessibilityManager.TouchExplorationStateChangeListener
|
private AccessibilityManager.TouchExplorationStateChangeListener
|
||||||
mTouchExplorationStateChangeListener;
|
mTouchExplorationStateChangeListener;
|
||||||
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||||
@@ -167,12 +168,15 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
final AccessibilityManager am = getPrefContext().getSystemService(
|
final AccessibilityManager am = getPrefContext().getSystemService(
|
||||||
AccessibilityManager.class);
|
AccessibilityManager.class);
|
||||||
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
mSettingsContentObserver.register(getContentResolver());
|
mSettingsContentObserver.register(getContentResolver());
|
||||||
updateShortcutPreferenceData();
|
updateShortcutPreferenceData();
|
||||||
updateShortcutPreference();
|
updateShortcutPreference();
|
||||||
|
|
||||||
|
updateEditShortcutDialogIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -200,31 +204,30 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(int dialogId) {
|
public Dialog onCreateDialog(int dialogId) {
|
||||||
final Dialog dialog;
|
|
||||||
switch (dialogId) {
|
switch (dialogId) {
|
||||||
case DialogEnums.EDIT_SHORTCUT:
|
case DialogEnums.EDIT_SHORTCUT:
|
||||||
final int dialogType = WizardManagerHelper.isAnySetupWizard(getIntent())
|
final int dialogType = WizardManagerHelper.isAnySetupWizard(getIntent())
|
||||||
? AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC_SUW :
|
? AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC_SUW :
|
||||||
AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC;
|
AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC;
|
||||||
dialog = AccessibilityDialogUtils.showEditShortcutDialog(
|
mDialog = AccessibilityDialogUtils.showEditShortcutDialog(
|
||||||
getPrefContext(), dialogType, getShortcutTitle(),
|
getPrefContext(), dialogType, getShortcutTitle(),
|
||||||
this::callOnAlertDialogCheckboxClicked);
|
this::callOnAlertDialogCheckboxClicked);
|
||||||
setupEditShortcutDialog(dialog);
|
setupEditShortcutDialog(mDialog);
|
||||||
return dialog;
|
return mDialog;
|
||||||
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
|
||||||
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||||
dialog = AccessibilityGestureNavigationTutorial
|
mDialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialogForSetupWizard(
|
.createAccessibilityTutorialDialogForSetupWizard(
|
||||||
getPrefContext(), getUserShortcutTypes(),
|
getPrefContext(), getUserShortcutTypes(),
|
||||||
this::callOnTutorialDialogButtonClicked);
|
this::callOnTutorialDialogButtonClicked);
|
||||||
} else {
|
} else {
|
||||||
dialog = AccessibilityGestureNavigationTutorial
|
mDialog = AccessibilityGestureNavigationTutorial
|
||||||
.createAccessibilityTutorialDialog(
|
.createAccessibilityTutorialDialog(
|
||||||
getPrefContext(), getUserShortcutTypes(),
|
getPrefContext(), getUserShortcutTypes(),
|
||||||
this::callOnTutorialDialogButtonClicked);
|
this::callOnTutorialDialogButtonClicked);
|
||||||
}
|
}
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
mDialog.setCanceledOnTouchOutside(false);
|
||||||
return dialog;
|
return mDialog;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
|
throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
|
||||||
}
|
}
|
||||||
@@ -368,6 +371,13 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
getPreferenceScreen().addPreference(generalCategory);
|
getPreferenceScreen().addPreference(generalCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateEditShortcutDialogIfNeeded() {
|
||||||
|
if (mDialog == null || !mDialog.isShowing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AccessibilityDialogUtils.updateShortcutInDialog(getContext(), mDialog);
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void saveNonEmptyUserShortcutType(int type) {
|
void saveNonEmptyUserShortcutType(int type) {
|
||||||
if (type == AccessibilityUtil.UserShortcutType.EMPTY) {
|
if (type == AccessibilityUtil.UserShortcutType.EMPTY) {
|
||||||
|
@@ -120,7 +120,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
|||||||
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
||||||
private boolean mNeedsQSTooltipReshow = false;
|
private boolean mNeedsQSTooltipReshow = false;
|
||||||
private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
|
private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
|
||||||
private boolean mSavedAccessibilityFloatingMenuEnabled;
|
|
||||||
private ImageView mImageGetterCacheView;
|
private ImageView mImageGetterCacheView;
|
||||||
protected final Html.ImageGetter mImageGetter = (String str) -> {
|
protected final Html.ImageGetter mImageGetter = (String str) -> {
|
||||||
if (str != null && str.startsWith(IMG_PREFIX)) {
|
if (str != null && str.startsWith(IMG_PREFIX)) {
|
||||||
@@ -276,8 +275,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
|||||||
AccessibilityManager.class);
|
AccessibilityManager.class);
|
||||||
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
|
||||||
mSettingsContentObserver.unregister(getContentResolver());
|
mSettingsContentObserver.unregister(getContentResolver());
|
||||||
mSavedAccessibilityFloatingMenuEnabled = AccessibilityUtil.isFloatingMenuEnabled(
|
|
||||||
getContext());
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user