Add back the shortcut dialog content for accessibility gesture

Below components are updated.
1. The dialog title, content, and customized link when edit shortcut.
2. The shortcut preference summary in Setting page.
3. The tutorial title and content when shortcut on.

Partial rollback from commit 5fe2cdcf87

Bug: 190563948
Test: Manual test
Change-Id: I5e39b46c9387b4bf5a10f14453be9988d8b7fc9c
This commit is contained in:
menghanli
2021-06-16 08:29:10 +08:00
committed by Menghan Li
parent a8d6dba649
commit f07aa0fa90
4 changed files with 102 additions and 30 deletions

View File

@@ -612,6 +612,18 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
return value;
}
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);
}
protected CharSequence getShortcutTypeSummary(Context context) {
if (!mShortcutPreference.isSettingsEditable()) {
return context.getText(R.string.accessibility_shortcut_edit_dialog_title_hardware);
@@ -625,11 +637,8 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
mComponentName.flattenToString(), 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(
@@ -639,7 +648,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
// 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= */