Correct shortcut summary to have different software types of shortcut result
Root Cause: Did not consider different software types shortcut in AccessibilityShortcutPreferenceFragment Solution: Add support for different software shortcut types Bug: 263451053 Test: manual change shortcut type and check Change-Id: Ic425fdab790d4bbf1de6418ada382e420a9860fc
This commit is contained in:
@@ -322,6 +322,18 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
getComponentName());
|
getComponentName());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be invoked when a button in the tutorial dialog is clicked.
|
* This method will be invoked when a button in the tutorial dialog is clicked.
|
||||||
*
|
*
|
||||||
@@ -429,11 +441,9 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
getComponentName().flattenToString(), AccessibilityUtil.UserShortcutType.SOFTWARE);
|
getComponentName().flattenToString(), AccessibilityUtil.UserShortcutType.SOFTWARE);
|
||||||
|
|
||||||
final List<CharSequence> list = new ArrayList<>();
|
final List<CharSequence> list = new ArrayList<>();
|
||||||
final CharSequence softwareTitle = context.getText(
|
|
||||||
R.string.accessibility_shortcut_edit_summary_software);
|
|
||||||
|
|
||||||
if (hasShortcutType(shortcutTypes, AccessibilityUtil.UserShortcutType.SOFTWARE)) {
|
if (hasShortcutType(shortcutTypes, AccessibilityUtil.UserShortcutType.SOFTWARE)) {
|
||||||
list.add(softwareTitle);
|
list.add(getSoftwareShortcutTypeSummary(context));
|
||||||
}
|
}
|
||||||
if (hasShortcutType(shortcutTypes, AccessibilityUtil.UserShortcutType.HARDWARE)) {
|
if (hasShortcutType(shortcutTypes, AccessibilityUtil.UserShortcutType.HARDWARE)) {
|
||||||
final CharSequence hardwareTitle = context.getText(
|
final CharSequence hardwareTitle = context.getText(
|
||||||
@@ -443,7 +453,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
|||||||
|
|
||||||
// Show software shortcut if first time to use.
|
// Show software shortcut if first time to use.
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
list.add(softwareTitle);
|
list.add(getSoftwareShortcutTypeSummary(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CaseMap.toTitle().wholeString().noLowercase().apply(Locale.getDefault(), /* iter= */
|
return CaseMap.toTitle().wholeString().noLowercase().apply(Locale.getDefault(), /* iter= */
|
||||||
|
Reference in New Issue
Block a user