Merge "Add back the shortcut dialog content for accessibility gesture" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-07-22 18:54:00 +00:00
committed by Android (Google) Code Review
4 changed files with 102 additions and 30 deletions

View File

@@ -265,6 +265,18 @@ public class ToggleScreenMagnificationPreferenceFragment extends
return (value & type) == type;
}
private static CharSequence getSoftwareShortcutTypeSummary(Context context) {
int resId;
if (AccessibilityUtil.isFloatingMenuEnabled(context)) {
resId = R.string.accessibility_shortcut_edit_summary_software;
} else if (AccessibilityUtil.isGestureNavigateEnabled(context)) {
resId = R.string.accessibility_shortcut_edit_summary_software_gesture;
} else {
resId = R.string.accessibility_shortcut_edit_summary_software;
}
return context.getText(resId);
}
@Override
protected CharSequence getShortcutTypeSummary(Context context) {
if (!mShortcutPreference.isChecked()) {
@@ -275,18 +287,14 @@ public class ToggleScreenMagnificationPreferenceFragment extends
MAGNIFICATION_CONTROLLER_NAME, UserShortcutType.SOFTWARE);
final List<CharSequence> list = new ArrayList<>();
final CharSequence softwareTitle = context.getText(
R.string.accessibility_shortcut_edit_summary_software);
if (hasShortcutType(shortcutTypes, UserShortcutType.SOFTWARE)) {
list.add(softwareTitle);
list.add(getSoftwareShortcutTypeSummary(context));
}
if (hasShortcutType(shortcutTypes, UserShortcutType.HARDWARE)) {
final CharSequence hardwareTitle = context.getText(
R.string.accessibility_shortcut_hardware_keyword);
list.add(hardwareTitle);
}
if (hasShortcutType(shortcutTypes, UserShortcutType.TRIPLETAP)) {
final CharSequence tripleTapTitle = context.getText(
R.string.accessibility_shortcut_triple_tap_keyword);
@@ -295,7 +303,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
// Show software shortcut if first time to use.
if (list.isEmpty()) {
list.add(softwareTitle);
list.add(getSoftwareShortcutTypeSummary(context));
}
return CaseMap.toTitle().wholeString().noLowercase().apply(Locale.getDefault(), /* iter= */