Merge changes from topic "tutorial_improvement" into rvc-dev am: b6bf10ebbc am: 15d20efe43 am: 636d68059e am: fbe9b33c73

Change-Id: I8711cc5c75a05d7865b22e411648debe3adda41e
This commit is contained in:
PETER LIANG
2020-04-23 13:28:37 +00:00
committed by Automerger Merge Worker
14 changed files with 588 additions and 27 deletions

View File

@@ -229,24 +229,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) {
@@ -413,18 +411,21 @@ public class ToggleScreenMagnificationPreferenceFragment extends
case DialogEnums.MAGNIFICATION_EDIT_SHORTCUT:
return SettingsEnums.DIALOG_MAGNIFICATION_EDIT_SHORTCUT;
default:
return 0;
return super.getDialogMetricsCategory(dialogId);
}
}
@Override
int getUserShortcutTypes() {
return getUserShortcutTypeFromSettings(getPrefContext());
}
@Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
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 +455,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);
}