Merge "Keyboard Shortcuts Helper: Include all System shortcuts" into nyc-dev

This commit is contained in:
Clara Bayarri
2016-04-01 11:17:24 +00:00
committed by Android (Google) Code Review
3 changed files with 81 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ public final class KeyboardShortcutInfo implements Parcelable {
mLabel = label;
mIcon = icon;
mBaseCharacter = MIN_VALUE;
checkArgument(keycode > KeyEvent.KEYCODE_UNKNOWN && keycode <= KeyEvent.getMaxKeyCode());
checkArgument(keycode >= KeyEvent.KEYCODE_UNKNOWN && keycode <= KeyEvent.getMaxKeyCode());
mKeycode = keycode;
mModifiers = modifiers;
}

View File

@@ -1388,6 +1388,31 @@
<string name="keyboard_shortcut_group_system_recents">Recents</string>
<!-- User visible title for the the keyboard shortcut that triggers the back action. -->
<string name="keyboard_shortcut_group_system_back">Back</string>
<!-- User visible title for the the keyboard shortcut that triggers the notification shade. -->
<string name="keyboard_shortcut_group_system_notifications">Notifications</string>
<!-- User visible title for the the keyboard shortcut that triggers the keyboard shortcuts helper. -->
<string name="keyboard_shortcut_group_system_shortcuts_helper">Keyboard Shortcuts</string>
<!-- User visible title for the the keyboard shortcut that switches input methods. -->
<string name="keyboard_shortcut_group_system_switch_input">Switch input method</string>
<!-- User visible title for the system-wide applications keyboard shortcuts list. -->
<string name="keyboard_shortcut_group_applications">Applications</string>
<!-- User visible title for the keyboard shortcut that takes the user to the assist app. -->
<string name="keyboard_shortcut_group_applications_assist">Assist</string>
<!-- User visible title for the keyboard shortcut that takes the user to the browser app. -->
<string name="keyboard_shortcut_group_applications_browser">Browser</string>
<!-- User visible title for the keyboard shortcut that takes the user to the contacts app. -->
<string name="keyboard_shortcut_group_applications_contacts">Contacts</string>
<!-- User visible title for the keyboard shortcut that takes the user to the email app. -->
<string name="keyboard_shortcut_group_applications_email">Email</string>
<!-- User visible title for the keyboard shortcut that takes the user to the instant messaging app. -->
<string name="keyboard_shortcut_group_applications_im">IM</string>
<!-- User visible title for the keyboard shortcut that takes the user to the music app. -->
<string name="keyboard_shortcut_group_applications_music">Music</string>
<!-- User visible title for the keyboard shortcut that takes the user to the YouTube app. -->
<string name="keyboard_shortcut_group_applications_youtube">YouTube</string>
<!-- User visible title for the keyboard shortcut that takes the user to the calendar app. -->
<string name="keyboard_shortcut_group_applications_calendar">Calendar</string>
<!-- SysUI Tuner: Option to show full do not disturb panel in volume [CHAR LIMIT=60] -->
<string name="tuner_full_zen_title">Show with volume controls</string>

View File

@@ -245,7 +245,57 @@ public class KeyboardShortcuts {
systemGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(R.string.keyboard_shortcut_group_system_recents),
KeyEvent.KEYCODE_TAB, KeyEvent.META_ALT_ON));
systemGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_system_notifications),
KeyEvent.KEYCODE_N, KeyEvent.META_META_ON));
systemGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_system_shortcuts_helper),
KeyEvent.KEYCODE_SLASH, KeyEvent.META_META_ON));
systemGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_system_switch_input),
KeyEvent.KEYCODE_SPACE, KeyEvent.META_META_ON));
result.add(systemGroup);
KeyboardShortcutGroup applicationGroup = new KeyboardShortcutGroup(
mContext.getString(R.string.keyboard_shortcut_group_applications),
true);
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_assist),
KeyEvent.KEYCODE_UNKNOWN, KeyEvent.META_META_ON));
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_browser),
KeyEvent.KEYCODE_B, KeyEvent.META_META_ON));
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_contacts),
KeyEvent.KEYCODE_C, KeyEvent.META_META_ON));
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_email),
KeyEvent.KEYCODE_E, KeyEvent.META_META_ON));
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_im),
KeyEvent.KEYCODE_T, KeyEvent.META_META_ON));
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_music),
KeyEvent.KEYCODE_P, KeyEvent.META_META_ON));
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_youtube),
KeyEvent.KEYCODE_Y, KeyEvent.META_META_ON));
applicationGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(
R.string.keyboard_shortcut_group_applications_calendar),
KeyEvent.KEYCODE_L, KeyEvent.META_META_ON));
result.add(applicationGroup);
showKeyboardShortcutsDialog(result);
}
}, deviceId);
@@ -354,11 +404,15 @@ public class KeyboardShortcuts {
return null;
}
String displayLabelString;
if (info.getKeycode() == KeyEvent.KEYCODE_UNKNOWN) {
if (info.getBaseCharacter() > Character.MIN_VALUE) {
displayLabelString = String.valueOf(info.getBaseCharacter());
} else if (SPECIAL_CHARACTER_NAMES.get(info.getKeycode()) != null) {
displayLabelString = SPECIAL_CHARACTER_NAMES.get(info.getKeycode());
} else {
// Special case for shortcuts with no base key or keycode.
if (info.getKeycode() == KeyEvent.KEYCODE_UNKNOWN) {
return shortcutKeys;
}
// TODO: Have a generic map for when we don't have the device's.
char displayLabel = mKeyCharacterMap == null
? 0 : mKeyCharacterMap.getDisplayLabel(info.getKeycode());