Java 类android.view.KeyboardShortcutGroup 实例源码

项目:LaunchEnr    文件:Launcher.java   
@Override
@TargetApi(Build.VERSION_CODES.N)
public void onProvideKeyboardShortcuts(
        List<KeyboardShortcutGroup> data, Menu menu, int deviceId) {

    ArrayList<KeyboardShortcutInfo> shortcutInfos = new ArrayList<>();
    if (mState == State.WORKSPACE) {
        shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.all_apps_button_label),
                KeyEvent.KEYCODE_A, KeyEvent.META_CTRL_ON));
    }
    View currentFocus = getCurrentFocus();
    if (new CustomActionsPopup(this, currentFocus).canShow()) {
        shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.custom_actions),
                KeyEvent.KEYCODE_O, KeyEvent.META_CTRL_ON));
    }
    if (currentFocus.getTag() instanceof ItemInfo
            && DeepShortcutManager.supportsShortcuts((ItemInfo) currentFocus.getTag())) {
        shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.action_deep_shortcut),
                KeyEvent.KEYCODE_S, KeyEvent.META_CTRL_ON));
    }
    if (!shortcutInfos.isEmpty()) {
        data.add(new KeyboardShortcutGroup(getString(R.string.home_screen), shortcutInfos));
    }

    super.onProvideKeyboardShortcuts(data, menu, deviceId);
}
项目:CompositeAndroid    文件:ActivityPlugin.java   
public void onProvideKeyboardShortcuts(final List<KeyboardShortcutGroup> data, final Menu menu,
        final int deviceId) {
    verifyMethodCalledFromDelegate(
            "onProvideKeyboardShortcuts(List<KeyboardShortcutGroup>, Menu, Integer)");
    ((CallVoid3<List<KeyboardShortcutGroup>, Menu, Integer>) mSuperListeners.pop())
            .call(data, menu, deviceId);
}
项目:CompositeAndroid    文件:ActivityPlugin.java   
void onProvideKeyboardShortcuts(
        final CallVoid3<List<KeyboardShortcutGroup>, Menu, Integer> superCall,
        final List<KeyboardShortcutGroup> data, final Menu menu, final int deviceId) {
    synchronized (mSuperListeners) {
        mSuperListeners.push(superCall);
        onProvideKeyboardShortcuts(data, menu, deviceId);
    }
}
项目:TopNotification    文件:AbstractWindowCallback.java   
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data, @Nullable Menu menu, int deviceId) {
    mCallback.onProvideKeyboardShortcuts(data, menu, deviceId);
}
项目:spline    文件:EditorActivity.java   
@Override
public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data, Menu menu, int deviceId) {
    super.onProvideKeyboardShortcuts(data, menu, deviceId);
}
项目:CompositeAndroid    文件:BlueprintActivity.java   
@Override
public void onProvideKeyboardShortcuts(final List<KeyboardShortcutGroup> data, final Menu menu,
        final int deviceId) {
    super.onProvideKeyboardShortcuts(data, menu, deviceId);
}
项目:CompositeAndroid    文件:CompositeActivity.java   
@Override
public void onProvideKeyboardShortcuts(final List<KeyboardShortcutGroup> data, final Menu menu,
        final int deviceId) {
    delegate.onProvideKeyboardShortcuts(data, menu, deviceId);
}
项目:CompositeAndroid    文件:CompositeActivity.java   
@Override
public void super_onProvideKeyboardShortcuts(final List<KeyboardShortcutGroup> data,
        final Menu menu, final int deviceId) {
    super.onProvideKeyboardShortcuts(data, menu, deviceId);
}
项目:CompositeAndroid    文件:ICompositeActivity.java   
void onProvideKeyboardShortcuts(final List<KeyboardShortcutGroup> data, final Menu menu,
final int deviceId);
项目:CompositeAndroid    文件:ICompositeActivity.java   
void super_onProvideKeyboardShortcuts(final List<KeyboardShortcutGroup> data, final Menu menu,
final int deviceId);
项目:365browser    文件:ChromeTabbedActivity.java   
@Override
public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data, Menu menu,
        int deviceId) {
    data.addAll(KeyboardShortcuts.createShortcutGroup(this));
}
项目:365browser    文件:KeyboardShortcuts.java   
/**
 * 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;
}
项目:365browser    文件:KeyboardShortcuts.java   
@TargetApi(Build.VERSION_CODES.N)
private static void addShortcut(Context context,
        KeyboardShortcutGroup shortcutGroup, int resId, int keyCode, int keyModifier) {
    shortcutGroup.addItem(new KeyboardShortcutInfo(context.getString(resId), keyCode,
            keyModifier));
}
项目:CustomDialog    文件:CustomDialog.java   
@Override
public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data, @Nullable Menu menu, int deviceId) {

}