Tutorial improvement for Accessibility shortcut (2/n).

Update UI widgets to meet the new design.

Bug: 148989018
Test: manual test
Change-Id: Ife42995af193db6746135d29f6fa1ad452d265a6
This commit is contained in:
Peter_Liang
2020-03-06 22:54:00 +08:00
parent cfe3e454ac
commit 72aa60ae95
7 changed files with 435 additions and 26 deletions

View File

@@ -224,24 +224,22 @@ public class ToggleScreenMagnificationPreferenceFragment extends
@Override
public Dialog onCreateDialog(int dialogId) {
final AlertDialog dialog;
switch (dialogId) {
case DialogEnums.GESTURE_NAVIGATION_TUTORIAL:
return AccessibilityGestureNavigationTutorial
.showGestureNavigationTutorialDialog(getPrefContext());
case DialogEnums.ACCESSIBILITY_BUTTON_TUTORIAL:
return AccessibilityGestureNavigationTutorial
.showAccessibilityButtonTutorialDialog(getPrefContext());
case DialogEnums.MAGNIFICATION_EDIT_SHORTCUT:
final CharSequence dialogTitle = getPrefContext().getString(
R.string.accessibility_shortcut_title, mPackageName);
final AlertDialog dialog =
AccessibilityEditDialogUtils.showMagnificationEditShortcutDialog(
dialog = AccessibilityEditDialogUtils.showMagnificationEditShortcutDialog(
getPrefContext(), dialogTitle,
this::callOnAlertDialogCheckboxClicked);
initializeDialogCheckBox(dialog);
return dialog;
default:
return super.onCreateDialog(dialogId);
}
throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
}
private void setDialogTextAreaClickListener(View dialogView, CheckBox checkBox) {
@@ -408,7 +406,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
case DialogEnums.MAGNIFICATION_EDIT_SHORTCUT:
return SettingsEnums.DIALOG_MAGNIFICATION_EDIT_SHORTCUT;
default:
return 0;
return super.getDialogMetricsCategory(dialogId);
}
}
@@ -422,9 +420,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
if (enabled && TextUtils.equals(
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED,
preferenceKey)) {
showDialog(AccessibilityUtil.isGestureNavigateEnabled(getPrefContext())
? DialogEnums.GESTURE_NAVIGATION_TUTORIAL
: DialogEnums.ACCESSIBILITY_BUTTON_TUTORIAL);
showDialog(DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL);
}
MagnificationPreferenceFragment.setChecked(getContentResolver(), preferenceKey, enabled);
}
@@ -454,6 +450,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
if (preference.isChecked()) {
optInAllMagnificationValuesToSettings(getPrefContext(), shortcutTypes);
showDialog(DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL);
} else {
optOutAllMagnificationValuesFromSettings(getPrefContext(), shortcutTypes);
}