Fix inconsistent shortcut strings on accessibility setting and edit dialog

Root cause: Base class provides an override function for accessibility settings shortcut preference. But, it cannot update to the edit dialog.
Solution: Refine the resilience function and base class apply into accessibility settings shortcut preference and edit dailog.

Bug: 228830417
Test: Manual testing on all accessibility page and edit dialog
Change-Id: I84bc63a39cd9cfa7e12944dff20ee6b92879008d
This commit is contained in:
menghanli
2022-04-15 08:00:36 +08:00
committed by Menghan Li
parent 3ed73b7b2d
commit 50520c2d3f
7 changed files with 18 additions and 26 deletions

View File

@@ -132,8 +132,8 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
mShortcutPreference.setPersistent(false);
mShortcutPreference.setKey(getShortcutPreferenceKey());
mShortcutPreference.setOnClickCallback(this);
mShortcutPreference.setTitle(getShortcutTitle());
updateShortcutTitle(mShortcutPreference);
getPreferenceScreen().addPreference(mShortcutPreference);
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
@@ -192,13 +192,11 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
final Dialog dialog;
switch (dialogId) {
case DialogEnums.EDIT_SHORTCUT:
final CharSequence dialogTitle = getPrefContext().getString(
R.string.accessibility_shortcut_title, getLabelName());
final int dialogType = WizardManagerHelper.isAnySetupWizard(getIntent())
? AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC_SUW :
AccessibilityDialogUtils.DialogType.EDIT_SHORTCUT_GENERIC;
dialog = AccessibilityDialogUtils.showEditShortcutDialog(
getPrefContext(), dialogType, dialogTitle,
getPrefContext(), dialogType, getShortcutTitle(),
this::callOnAlertDialogCheckboxClicked);
setupEditShortcutDialog(dialog);
return dialog;
@@ -213,9 +211,8 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
}
}
protected void updateShortcutTitle(ShortcutPreference shortcutPreference) {
final CharSequence title = getString(R.string.accessibility_shortcut_title, getLabelName());
shortcutPreference.setTitle(title);
protected CharSequence getShortcutTitle() {
return getString(R.string.accessibility_shortcut_title, getLabelName());
}
@Override