Java Code Examples for android.view.KeyEvent#META_SHIFT_ON

The following examples show how to use android.view.KeyEvent#META_SHIFT_ON . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EspressoKey.java    From android-test with Apache License 2.0 6 votes vote down vote up
private int getMetaState() {
  int metaState = 0;
  if (isShiftPressed) {
    metaState |= KeyEvent.META_SHIFT_ON;
  }

  if (isAltPressed) {
    metaState |= KeyEvent.META_ALT_ON;
  }

  if (isCtrlPressed && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    metaState |= KeyEvent.META_CTRL_ON;
  }

  return metaState;
}
 
Example 2
Source File: ImeAdapter.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static int getModifiers(int metaState) {
    int modifiers = 0;
    if ((metaState & KeyEvent.META_SHIFT_ON) != 0) {
      modifiers |= sModifierShift;
    }
    if ((metaState & KeyEvent.META_ALT_ON) != 0) {
      modifiers |= sModifierAlt;
    }
    if ((metaState & KeyEvent.META_CTRL_ON) != 0) {
      modifiers |= sModifierCtrl;
    }
    if ((metaState & KeyEvent.META_CAPS_LOCK_ON) != 0) {
      modifiers |= sModifierCapsLockOn;
    }
    if ((metaState & KeyEvent.META_NUM_LOCK_ON) != 0) {
      modifiers |= sModifierNumLockOn;
    }
    return modifiers;
}
 
Example 3
Source File: ImeAdapter.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static int getModifiers(int metaState) {
    int modifiers = 0;
    if ((metaState & KeyEvent.META_SHIFT_ON) != 0) {
      modifiers |= sModifierShift;
    }
    if ((metaState & KeyEvent.META_ALT_ON) != 0) {
      modifiers |= sModifierAlt;
    }
    if ((metaState & KeyEvent.META_CTRL_ON) != 0) {
      modifiers |= sModifierCtrl;
    }
    if ((metaState & KeyEvent.META_CAPS_LOCK_ON) != 0) {
      modifiers |= sModifierCapsLockOn;
    }
    if ((metaState & KeyEvent.META_NUM_LOCK_ON) != 0) {
      modifiers |= sModifierNumLockOn;
    }
    return modifiers;
}
 
Example 4
Source File: LayerRowCallbacks.java    From spline with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onSingleTapUp(MotionEvent event) {
    if (adapter != null && currentTouchLayer != null) {
        int metaState = event.getMetaState();
        boolean isShiftPressed = (metaState & KeyEvent.META_SHIFT_ON) != 0;

        if (!currentTouchIsSecondaryButton
                || !(adapter.getCurrentLayer() instanceof SelectionGroup)
                || ((SelectionGroup) adapter.getCurrentLayer()).getLayers().size() < 2) {
            Layer selection = LayerUtils.selectionFrom(
                    adapter.getCurrentLayer(), currentTouchLayer, isShiftPressed);
            adapter.setCurrentLayer(selection);
        }

        if (currentTouchIsSecondaryButton) {
            currentTouchView.showContextMenu(event.getX(), event.getY());
        }
    }

    return true;
}
 
Example 5
Source File: MenuBuilder.java    From android-apps with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
void findItemsWithShortcutForKey(List<MenuItemImpl> items, int keyCode, KeyEvent event) {
    final boolean qwerty = isQwertyMode();
    final int metaState = event.getMetaState();
    final KeyCharacterMap.KeyData possibleChars = new KeyCharacterMap.KeyData();
    // Get the chars associated with the keyCode (i.e using any chording combo)
    final boolean isKeyCodeMapped = event.getKeyData(possibleChars);
    // The delete key is not mapped to '\b' so we treat it specially
    if (!isKeyCodeMapped && (keyCode != KeyEvent.KEYCODE_DEL)) {
        return;
    }

    // Look for an item whose shortcut is this key.
    final int N = mItems.size();
    for (int i = 0; i < N; i++) {
        MenuItemImpl item = mItems.get(i);
        if (item.hasSubMenu()) {
            ((MenuBuilder)item.getSubMenu()).findItemsWithShortcutForKey(items, keyCode, event);
        }
        final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut();
        if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) &&
              (shortcutChar != 0) &&
              (shortcutChar == possibleChars.meta[0]
                  || shortcutChar == possibleChars.meta[2]
                  || (qwerty && shortcutChar == '\b' &&
                      keyCode == KeyEvent.KEYCODE_DEL)) &&
              item.isEnabled()) {
            items.add(item);
        }
    }
}
 
Example 6
Source File: BaseMovementMethod.java    From JotaTextEditor with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) {
    if ((ApiWrapper.getSourceOfEvent(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_SCROLL: {
                final float vscroll;
                final float hscroll;
                if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
                    vscroll = 0;
                    hscroll = ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
                } else {
                    vscroll = -ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
                    hscroll = ApiWrapper.getAxisValue(event,MotionEvent.AXIS_HSCROLL);
                }

                boolean handled = false;
                if (hscroll < 0) {
                    handled |= scrollLeft(widget, text, (int)Math.ceil(-hscroll));
                } else if (hscroll > 0) {
                    handled |= scrollRight(widget, text, (int)Math.ceil(hscroll));
                }
                if (vscroll < 0) {
                    handled |= scrollUp(widget, text, (int)Math.ceil(-vscroll));
                    if ( handled ){
                    	widget.moveCursorToVisibleOffset();
                    }
                } else if (vscroll > 0) {
                    handled |= scrollDown(widget, text, (int)Math.ceil(vscroll));
                    if ( handled ){
                    	widget.moveCursorToVisibleOffset();
                    }
                }
                return handled;
            }
        }
    }
    return false;
}
 
Example 7
Source File: MenuBuilder.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
void findItemsWithShortcutForKey(List<MenuItemImpl> items, int keyCode, KeyEvent event) {
    final boolean qwerty = isQwertyMode();
    final int metaState = event.getMetaState();
    final KeyCharacterMap.KeyData possibleChars = new KeyCharacterMap.KeyData();
    // Get the chars associated with the keyCode (i.e using any chording combo)
    final boolean isKeyCodeMapped = event.getKeyData(possibleChars);
    // The delete key is not mapped to '\b' so we treat it specially
    if (!isKeyCodeMapped && (keyCode != KeyEvent.KEYCODE_DEL)) {
        return;
    }

    // Look for an item whose shortcut is this key.
    final int N = mItems.size();
    for (int i = 0; i < N; i++) {
        MenuItemImpl item = mItems.get(i);
        if (item.hasSubMenu()) {
            ((MenuBuilder)item.getSubMenu()).findItemsWithShortcutForKey(items, keyCode, event);
        }
        final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut();
        if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) &&
              (shortcutChar != 0) &&
              (shortcutChar == possibleChars.meta[0]
                  || shortcutChar == possibleChars.meta[2]
                  || (qwerty && shortcutChar == '\b' &&
                      keyCode == KeyEvent.KEYCODE_DEL)) &&
              item.isEnabled()) {
            items.add(item);
        }
    }
}
 
Example 8
Source File: KeyAssignmentUtils.java    From talkback with Apache License 2.0 5 votes vote down vote up
/**
 * Convert a KeyEvent into a long which can be kept in settings and compared to key presses when
 * the service is in use.
 *
 * @param keyEvent The key event to convert. The (non-extended) keycode must not be a modifier.
 * @return An extended key code that includes modifier information
 */
public static long keyEventToExtendedKeyCode(KeyEvent keyEvent) {
  long returnValue = keyEvent.getKeyCode();
  returnValue |= (keyEvent.isShiftPressed()) ? (((long) KeyEvent.META_SHIFT_ON) << 32) : 0;
  returnValue |= (keyEvent.isCtrlPressed()) ? (((long) KeyEvent.META_CTRL_ON) << 32) : 0;
  returnValue |= (keyEvent.isAltPressed()) ? (((long) KeyEvent.META_ALT_ON) << 32) : 0;
  return returnValue;
}
 
Example 9
Source File: KeyEventCompat.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
@Override
public int normalizeMetaState(int metaState) {
    if ((metaState & (KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_RIGHT_ON)) != 0) {
        metaState |= KeyEvent.META_SHIFT_ON;
    }
    if ((metaState & (KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_RIGHT_ON)) != 0) {
        metaState |= KeyEvent.META_ALT_ON;
    }
    return metaState & META_ALL_MASK;
}
 
Example 10
Source File: KeyEventCompat.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int normalizeMetaState(int metaState) {
    if ((metaState & (KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_RIGHT_ON)) != 0) {
        metaState |= KeyEvent.META_SHIFT_ON;
    }
    if ((metaState & (KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_RIGHT_ON)) != 0) {
        metaState |= KeyEvent.META_ALT_ON;
    }
    return metaState & META_ALL_MASK;
}
 
Example 11
Source File: PagedView.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
    if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_SCROLL: {
                // Handle mouse (or ext. device) by shifting the page depending on the scroll
                final float vscroll;
                final float hscroll;
                if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
                    vscroll = 0;
                    hscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
                } else {
                    vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);
                    hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
                }
                if (hscroll != 0 || vscroll != 0) {
                    boolean isForwardScroll = mIsRtl ? (hscroll < 0 || vscroll < 0)
                                                     : (hscroll > 0 || vscroll > 0);
                    if (isForwardScroll) {
                        scrollRight();
                    } else {
                        scrollLeft();
                    }
                    return true;
                }
            }
        }
    }
    return super.onGenericMotionEvent(event);
}
 
Example 12
Source File: MenuBuilder.java    From zen4android with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
void findItemsWithShortcutForKey(List<MenuItemImpl> items, int keyCode, KeyEvent event) {
    final boolean qwerty = isQwertyMode();
    final int metaState = event.getMetaState();
    final KeyCharacterMap.KeyData possibleChars = new KeyCharacterMap.KeyData();
    // Get the chars associated with the keyCode (i.e using any chording combo)
    final boolean isKeyCodeMapped = event.getKeyData(possibleChars);
    // The delete key is not mapped to '\b' so we treat it specially
    if (!isKeyCodeMapped && (keyCode != KeyEvent.KEYCODE_DEL)) {
        return;
    }

    // Look for an item whose shortcut is this key.
    final int N = mItems.size();
    for (int i = 0; i < N; i++) {
        MenuItemImpl item = mItems.get(i);
        if (item.hasSubMenu()) {
            ((MenuBuilder)item.getSubMenu()).findItemsWithShortcutForKey(items, keyCode, event);
        }
        final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut();
        if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) &&
              (shortcutChar != 0) &&
              (shortcutChar == possibleChars.meta[0]
                  || shortcutChar == possibleChars.meta[2]
                  || (qwerty && shortcutChar == '\b' &&
                      keyCode == KeyEvent.KEYCODE_DEL)) &&
              item.isEnabled()) {
            items.add(item);
        }
    }
}
 
Example 13
Source File: SliderKeyTestCommon.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testFocusFirstThumb_shiftTab_unhandled() {
  slider.requestFocus();

  slider.setFocusedThumbIndex(0);

  KeyEventBuilder tab = new KeyEventBuilder(KeyEvent.KEYCODE_TAB);
  tab.meta = KeyEvent.META_SHIFT_ON;
  boolean handledDown = slider.dispatchKeyEvent(tab.buildDown());
  boolean handledUp = slider.dispatchKeyEvent(tab.buildUp());

  assertThat(handledDown).isFalse();
  assertThat(handledUp).isFalse();
}
 
Example 14
Source File: SliderKeyTestCommon.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testMoveThumbFocus_tab_correctThumbHasFocus() {
  slider.requestFocus();

  KeyEventBuilder tab = new KeyEventBuilder(KeyEvent.KEYCODE_TAB);
  KeyEventBuilder shiftTab = new KeyEventBuilder(KeyEvent.KEYCODE_TAB, KeyEvent.META_SHIFT_ON);

  sendKeyEventThereAndBack(tab, shiftTab);
}
 
Example 15
Source File: MenuBuilder.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
void findItemsWithShortcutForKey(List<MenuItemImpl> items, int keyCode, KeyEvent event) {
    final boolean qwerty = isQwertyMode();
    final int metaState = event.getMetaState();
    final KeyCharacterMap.KeyData possibleChars = new KeyCharacterMap.KeyData();
    // Get the chars associated with the keyCode (i.e using any chording combo)
    final boolean isKeyCodeMapped = event.getKeyData(possibleChars);
    // The delete key is not mapped to '\b' so we treat it specially
    if (!isKeyCodeMapped && (keyCode != KeyEvent.KEYCODE_DEL)) {
        return;
    }

    // Look for an item whose shortcut is this key.
    final int N = mItems.size();
    for (int i = 0; i < N; i++) {
        MenuItemImpl item = mItems.get(i);
        if (item.hasSubMenu()) {
            ((MenuBuilder)item.getSubMenu()).findItemsWithShortcutForKey(items, keyCode, event);
        }
        final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut();
        if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) &&
              (shortcutChar != 0) &&
              (shortcutChar == possibleChars.meta[0]
                  || shortcutChar == possibleChars.meta[2]
                  || (qwerty && shortcutChar == '\b' &&
                      keyCode == KeyEvent.KEYCODE_DEL)) &&
              item.isEnabled()) {
            items.add(item);
        }
    }
}
 
Example 16
Source File: BaseMovementMethod.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) {
    if ((ApiWrapper.getSourceOfEvent(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_SCROLL: {
                final float vscroll;
                final float hscroll;
                if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
                    vscroll = 0;
                    hscroll = ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
                } else {
                    vscroll = -ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
                    hscroll = ApiWrapper.getAxisValue(event,MotionEvent.AXIS_HSCROLL);
                }

                boolean handled = false;
                if (hscroll < 0) {
                    handled |= scrollLeft(widget, text, (int)Math.ceil(-hscroll));
                } else if (hscroll > 0) {
                    handled |= scrollRight(widget, text, (int)Math.ceil(hscroll));
                }
                if (vscroll < 0) {
                    handled |= scrollUp(widget, text, (int)Math.ceil(-vscroll));
                    if ( handled ){
                    	widget.moveCursorToVisibleOffset();
                    }
                } else if (vscroll > 0) {
                    handled |= scrollDown(widget, text, (int)Math.ceil(vscroll));
                    if ( handled ){
                    	widget.moveCursorToVisibleOffset();
                    }
                }
                return handled;
            }
        }
    }
    return false;
}
 
Example 17
Source File: KeyEventCompat.java    From guideshow with MIT License 5 votes vote down vote up
@Override
public int normalizeMetaState(int metaState) {
    if ((metaState & (KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_RIGHT_ON)) != 0) {
        metaState |= KeyEvent.META_SHIFT_ON;
    }
    if ((metaState & (KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_RIGHT_ON)) != 0) {
        metaState |= KeyEvent.META_ALT_ON;
    }
    return metaState & META_ALL_MASK;
}
 
Example 18
Source File: BaseMovementMethod.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) {
    if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_SCROLL: {
                final float vscroll;
                final float hscroll;
                if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
                    vscroll = 0;
                    hscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
                } else {
                    vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);
                    hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
                }

                boolean handled = false;
                if (hscroll < 0) {
                    handled |= scrollLeft(widget, text, (int)Math.ceil(-hscroll));
                } else if (hscroll > 0) {
                    handled |= scrollRight(widget, text, (int)Math.ceil(hscroll));
                }
                if (vscroll < 0) {
                    handled |= scrollUp(widget, text, (int)Math.ceil(-vscroll));
                } else if (vscroll > 0) {
                    handled |= scrollDown(widget, text, (int)Math.ceil(vscroll));
                }
                return handled;
            }
        }
    }
    return false;
}
 
Example 19
Source File: MenuBuilder.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
void findItemsWithShortcutForKey(List<MenuItemImpl> items, int keyCode, KeyEvent event) {
    final boolean qwerty = isQwertyMode();
    final int metaState = event.getMetaState();
    final KeyCharacterMap.KeyData possibleChars = new KeyCharacterMap.KeyData();
    // Get the chars associated with the keyCode (i.e using any chording combo)
    final boolean isKeyCodeMapped = event.getKeyData(possibleChars);
    // The delete key is not mapped to '\b' so we treat it specially
    if (!isKeyCodeMapped && (keyCode != KeyEvent.KEYCODE_DEL)) {
        return;
    }

    // Look for an item whose shortcut is this key.
    final int N = mItems.size();
    for (int i = 0; i < N; i++) {
        MenuItemImpl item = mItems.get(i);
        if (item.hasSubMenu()) {
            ((MenuBuilder)item.getSubMenu()).findItemsWithShortcutForKey(items, keyCode, event);
        }
        final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut();
        if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) &&
              (shortcutChar != 0) &&
              (shortcutChar == possibleChars.meta[0]
                  || shortcutChar == possibleChars.meta[2]
                  || (qwerty && shortcutChar == '\b' &&
                      keyCode == KeyEvent.KEYCODE_DEL)) &&
              item.isEnabled()) {
            items.add(item);
        }
    }
}
 
Example 20
Source File: KeyboardShortcuts.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * This method should be called when overriding from
 * {@link android.app.Activity#onProvideKeyboardShortcuts(List, android.view.Menu, int)}
 * in an activity. It will return a list of the possible shortcuts. If
 * someone adds a shortcut they also need to add an explanation in the
 * appropriate group in this method so the user can see it when this method
 * is called.
 *
 * @param context We need an activity so we can call the strings from our
 *            resource.
 * @return a list of shortcuts organized into groups.
 */
@TargetApi(Build.VERSION_CODES.N)
public static List<KeyboardShortcutGroup> createShortcutGroup(Context context) {

    final int ctrlShift = KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON;

    List<KeyboardShortcutGroup> shortcutGroups = new ArrayList<>();

    KeyboardShortcutGroup tabShortcutGroup = new KeyboardShortcutGroup(
            context.getString(R.string.keyboard_shortcut_tab_group_header));
    addShortcut(context, tabShortcutGroup, R.string.keyboard_shortcut_open_new_tab,
            KeyEvent.KEYCODE_N, KeyEvent.META_CTRL_ON);
    addShortcut(context, tabShortcutGroup, R.string.keyboard_shortcut_reopen_new_tab,
            KeyEvent.KEYCODE_T, ctrlShift);
    addShortcut(context, tabShortcutGroup, R.string.keyboard_shortcut_new_incognito_tab,
            KeyEvent.KEYCODE_N, ctrlShift);
    addShortcut(context, tabShortcutGroup, R.string.keyboard_shortcut_next_tab,
            KeyEvent.KEYCODE_TAB, KeyEvent.META_CTRL_ON);
    addShortcut(context, tabShortcutGroup, R.string.keyboard_shortcut_prev_tab,
            KeyEvent.KEYCODE_TAB, ctrlShift);
    addShortcut(context, tabShortcutGroup, R.string.keyboard_shortcut_close_tab,
            KeyEvent.KEYCODE_W, KeyEvent.META_CTRL_ON);
    shortcutGroups.add(tabShortcutGroup);

    KeyboardShortcutGroup chromeFeatureShortcutGroup = new KeyboardShortcutGroup(
            context.getString(R.string.keyboard_shortcut_chrome_feature_group_header));
    addShortcut(context, chromeFeatureShortcutGroup, R.string.keyboard_shortcut_open_menu,
            KeyEvent.KEYCODE_E, KeyEvent.META_ALT_ON);
    addShortcut(context, chromeFeatureShortcutGroup,
            R.string.keyboard_shortcut_bookmark_manager, KeyEvent.KEYCODE_B, ctrlShift);
    addShortcut(context, chromeFeatureShortcutGroup, R.string.keyboard_shortcut_history_manager,
            KeyEvent.KEYCODE_H, KeyEvent.META_CTRL_ON);
    addShortcut(context, chromeFeatureShortcutGroup, R.string.keyboard_shortcut_find_bar,
            KeyEvent.KEYCODE_F, KeyEvent.META_CTRL_ON);
    addShortcut(context, chromeFeatureShortcutGroup, R.string.keyboard_shortcut_address_bar,
            KeyEvent.KEYCODE_L, KeyEvent.META_CTRL_ON);
    shortcutGroups.add(chromeFeatureShortcutGroup);

    KeyboardShortcutGroup webpageShortcutGroup = new KeyboardShortcutGroup(
            context.getString(R.string.keyboard_shortcut_webpage_group_header));
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_print_page,
            KeyEvent.KEYCODE_P, KeyEvent.META_CTRL_ON);
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_reload_page,
            KeyEvent.KEYCODE_R, KeyEvent.META_CTRL_ON);
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_reload_no_cache,
            KeyEvent.KEYCODE_R, ctrlShift);
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_bookmark_page,
            KeyEvent.KEYCODE_D, KeyEvent.META_CTRL_ON);
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_zoom_in,
            KeyEvent.KEYCODE_EQUALS, KeyEvent.META_CTRL_ON);
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_zoom_out,
            KeyEvent.KEYCODE_MINUS, KeyEvent.META_CTRL_ON);
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_reset_zoom,
            KeyEvent.KEYCODE_0, KeyEvent.META_CTRL_ON);
    addShortcut(context, webpageShortcutGroup, R.string.keyboard_shortcut_help_center,
            KeyEvent.KEYCODE_SLASH, ctrlShift);
    shortcutGroups.add(webpageShortcutGroup);

    return shortcutGroups;
}