Example usage for android.view KeyEvent KEYCODE_MENU

List of usage examples for android.view KeyEvent KEYCODE_MENU

Introduction

In this page you can find the example usage for android.view KeyEvent KEYCODE_MENU.

Prototype

int KEYCODE_MENU

To view the source code for android.view KeyEvent KEYCODE_MENU.

Click Source Link

Document

Key code constant: Menu key.

Usage

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

boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
    case KeyEvent.KEYCODE_MENU:
        onKeyDownPanel(Window.FEATURE_OPTIONS_PANEL, event);
        return true;
    }/*from  w  w  w.  j  av a2 s. c o m*/

    // On API v7-10 we need to manually call onKeyShortcut() as this is not called
    // from the Activity
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        return onKeyShortcut(keyCode, event);
    }
    return false;
}

From source file:emu.project64.GalleryActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
            mDrawerLayout.closeDrawer(GravityCompat.START);
        } else {//from  ww  w  .  j  a va2  s  .c o m
            mDrawerLayout.openDrawer(GravityCompat.START);
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.mb.android.MainActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        RespondToWebView("LibraryMenu.onHardwareMenuButtonClick();");
        return true;
    } else {//ww w  .  j a v  a 2  s.  c o m
        return super.onKeyUp(keyCode, event);
    }
}

From source file:com.dish.browser.activity.BrowserActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_ENTER) {
        if (mSearch.hasFocus()) {
            searchTheWeb(mSearch.getText().toString());
        }/*from   ww w  .j  a va 2 s.co  m*/
    } else if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
            && (Build.MANUFACTURER.compareTo("LGE") == 0)) {
        // Workaround for stupid LG devices that crash
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.dish.browser.activity.BrowserActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
            && (Build.MANUFACTURER.compareTo("LGE") == 0)) {
        // Workaround for stupid LG devices that crash
        openOptionsMenu();/*from   ww  w . ja v  a2 s .  c o  m*/
        return true;
    }
    return super.onKeyUp(keyCode, event);
}

From source file:edu.pitt.gis.uniapp.UniApp.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    //Determine if the focus is on the current view or not
    if (appView.getHitTestResult() != null
            && appView.getHitTestResult().getType() == WebView.HitTestResult.EDIT_TEXT_TYPE
            && (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU)) {
        return appView.onKeyUp(keyCode, event);
    } else if (appView.isCustomViewShowing() && keyCode == KeyEvent.KEYCODE_BACK) {
        return appView.onKeyUp(keyCode, event);
    } else {/*from  w ww .j  ava2  s  .  c om*/
        return super.onKeyUp(keyCode, event);
    }
}

From source file:it.geosolutions.android.map.MapsActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        mDrawerLayout.openDrawer(mDrawerList);
        return true;
    }/*from   ww  w  .  ja  v a 2  s  . c o  m*/
    return super.onKeyUp(keyCode, event);
}

From source file:net.smartpager.android.activity.MainActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    // exclude keyboard appearance on volume change
    switch (keyCode) {
    case KeyEvent.KEYCODE_VOLUME_UP:
    case KeyEvent.KEYCODE_VOLUME_DOWN:
    case KeyEvent.KEYCODE_MENU:
        return super.onKeyUp(keyCode, event);
    default://from   ww w .j av a  2s  .c o m
        break;
    }

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(0, 0);

    return super.onKeyUp(keyCode, event);
}

From source file:org.videolan.vlc.gui.MyFragment.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    //Filter for LG devices, see https://code.google.com/p/android/issues/detail?id=78154
    btn = (Button) findViewById(R.id.back_btn);
    if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
        //btn=(Button) findViewById(R.id.back_btn);
        btn.setVisibility(View.VISIBLE);
        super.onBackPressed();
        return false;
    } else {/*from   w ww  .ja  va 2s  .  c o  m*/
        if (getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder) != null) {
            //((FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder)).browseUp();
            btn.setVisibility(View.GONE);
            finish();
            return false;
        }
    }
    //key_back() ;

    if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
            && (Build.MANUFACTURER.compareTo("LGE") == 0)) {
        return true;
    }
    if (mFocusedPrior == 0)
        setMenuFocusDown(true, 0);
    if (getCurrentFocus() != null)
        mFocusedPrior = getCurrentFocus().getId();
    return super.onKeyDown(keyCode, event);
}

From source file:com.undatech.opaque.RemoteCanvasActivity.java

@Override
public boolean onKey(View v, int keyCode, KeyEvent evt) {
    boolean consumed = false;

    if (keyCode == KeyEvent.KEYCODE_MENU) {
        if (evt.getAction() == KeyEvent.ACTION_DOWN)
            return super.onKeyDown(keyCode, evt);
        else/*from  w w  w  .  ja  v a2  s . c om*/
            return super.onKeyUp(keyCode, evt);
    }

    try {
        if (evt.getAction() == KeyEvent.ACTION_DOWN || evt.getAction() == KeyEvent.ACTION_MULTIPLE) {
            consumed = inputHandler.onKeyDown(keyCode, evt);
        } else if (evt.getAction() == KeyEvent.ACTION_UP) {
            consumed = inputHandler.onKeyUp(keyCode, evt);
        }
        resetOnScreenKeys(keyCode);
    } catch (NullPointerException e) {
    }

    return consumed;
}