Example usage for android.app ActionBar onKeyShortcut

List of usage examples for android.app ActionBar onKeyShortcut

Introduction

In this page you can find the example usage for android.app ActionBar onKeyShortcut.

Prototype

public boolean onKeyShortcut(int keyCode, KeyEvent event) 

Source Link

Usage

From source file:android.support.v7.app.AppCompatDelegateImplV7.java

@Override
boolean onKeyShortcut(int keyCode, KeyEvent ev) {
    // Let the Action Bar have a chance at handling the shortcut
    ActionBar ab = getSupportActionBar();
    if (ab != null && ab.onKeyShortcut(keyCode, ev)) {
        return true;
    }//from  w ww  .j  a va 2  s.  c  o m

    // If the panel is already prepared, then perform the shortcut using it.
    boolean handled;
    if (mPreparedPanel != null) {
        handled = performPanelShortcut(mPreparedPanel, ev.getKeyCode(), ev, Menu.FLAG_PERFORM_NO_CLOSE);
        if (handled) {
            if (mPreparedPanel != null) {
                mPreparedPanel.isHandled = true;
            }
            return true;
        }
    }

    // If the panel is not prepared, then we may be trying to handle a shortcut key
    // combination such as Control+C.  Temporarily prepare the panel then mark it
    // unprepared again when finished to ensure that the panel will again be prepared
    // the next time it is shown for real.
    if (mPreparedPanel == null) {
        PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
        preparePanel(st, ev);
        handled = performPanelShortcut(st, ev.getKeyCode(), ev, Menu.FLAG_PERFORM_NO_CLOSE);
        st.isPrepared = false;
        if (handled) {
            return true;
        }
    }
    return false;
}