List of usage examples for android.view KeyEvent KEYCODE_MENU
int KEYCODE_MENU
To view the source code for android.view KeyEvent KEYCODE_MENU.
Click Source Link
From source file:com.pcinpact.ListeArticlesActivity.java
/** * Ouverture du menu de l'action bar l'utilisation du bouton menu *//* w ww. j a va2s . c o m*/ @Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_MENU: monMenu.performIdentifierAction(R.id.action_overflow, 0); return true; } return super.onKeyUp(keyCode, event); }
From source file:com.kaliturin.blacklist.activities.MainActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else {/*from w w w . j av a 2 s . c o m*/ drawer.openDrawer(GravityCompat.START); } return true; } return super.onKeyUp(keyCode, event); }
From source file:com.untappedkegg.rally.home.ActivityMain.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { if (!mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { mDrawerLayout.openDrawer(Gravity.LEFT); } else {//from ww w .j av a 2s.com mDrawerLayout.closeDrawers(); } return true; } return super.onKeyUp(keyCode, event); }
From source file:com.crearo.gpslogger.GpsMainActivity.java
public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { toggleDrawer();/*w ww . j av a2s . com*/ } return super.onKeyUp(keyCode, event); }
From source file:us.nineworlds.serenity.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean menuKeySlidingMenu = preferences.getBoolean("remote_control_menu", true); if (menuKeySlidingMenu) { if (keyCode == KeyEvent.KEYCODE_MENU) { if (drawerLayout.isDrawerOpen(linearDrawerLayout)) { drawerLayout.closeDrawers(); View menu = findViewById(R.id.mainGalleryMenu); if (menu != null) { menu.requestFocusFromTouch(); }//from w w w.j a v a 2 s .c o m } else { drawerLayout.openDrawer(linearDrawerLayout); drawerList.requestFocusFromTouch(); } return true; } } if (drawerLayout.isDrawerOpen(linearDrawerLayout) && keyCode == KeyEvent.KEYCODE_BACK) { drawerLayout.closeDrawer(linearDrawerLayout); View menu = findViewById(R.id.mainGalleryMenu); if (menu != null) { menu.requestFocusFromTouch(); } return true; } return super.onKeyDown(keyCode, event); }
From source file:com.ternup.caddisfly.activity.MainActivity.java
@Override public boolean onKeyDown(int keycode, KeyEvent e) { switch (keycode) { case KeyEvent.KEYCODE_MENU: mNavigationDrawerFragment.toggleDrawer(); return true; }// w w w . j av a 2 s . co m return super.onKeyDown(keycode, e); }
From source file:org.apache.cordova.X5CoreAndroid.java
/** * Override the default behavior of the Android volume buttons. * If overridden, when the volume button is pressed, the "volume[up|down]button" JavaScript event will be fired. * * @param button volumeup, volumedown * @param override T=override, F=cancel override *///www.j ava 2s .c om public void overrideButton(String button, boolean override) { LOG.i("App", "WARNING: Volume Button Default Behavior will be overridden. The volume event will be fired!"); if (button.equals("volumeup")) { webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_UP, override); } else if (button.equals("volumedown")) { webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_DOWN, override); } else if (button.equals("menubutton")) { webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_MENU, override); } }
From source file:org.horaapps.leafpic.activities.PlayerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(org.horaapps.leafpic.R.layout.activity_player); FrameLayout root = (FrameLayout) findViewById(org.horaapps.leafpic.R.id.root); findViewById(R.id.video_frame).setOnClickListener(new View.OnClickListener() { @Override//from w w w .j av a 2 s .c o m public void onClick(View view) { toggleControlsVisibility(); } }); root.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { return !(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE || keyCode == KeyEvent.KEYCODE_MENU) && mediaController.dispatchKeyEvent(event); } }); root.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000)); shutterView = findViewById(org.horaapps.leafpic.R.id.shutter); videoFrame = (AspectRatioFrameLayout) findViewById(org.horaapps.leafpic.R.id.video_frame); surfaceView = (SurfaceView) findViewById(org.horaapps.leafpic.R.id.surface_view); surfaceView.getHolder().addCallback(this); mediaController = new CustomMediaController(this, this); mediController_anchor = findViewById(org.horaapps.leafpic.R.id.media_player_anchor); mediaController.setAnchorView(root); //mediaController.setPaddingRelative(0,0,0,Measure.getNavBarHeight(PlayerActivity.this)); toolbar = (Toolbar) findViewById(org.horaapps.leafpic.R.id.toolbar); initUI(); CookieHandler currentHandler = CookieHandler.getDefault(); if (currentHandler != defaultCookieManager) CookieHandler.setDefault(defaultCookieManager); audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this); audioCapabilitiesReceiver.register(); }
From source file:com.github.obsessive.simplifyreader.ui.activity.HomeActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (event.getKeyCode() == KeyEvent.KEYCODE_MENU) { if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { mDrawerLayout.closeDrawer(Gravity.LEFT); } else {//from w ww. java2 s .c om mDrawerLayout.openDrawer(Gravity.LEFT); } return true; } else if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { mDrawerLayout.closeDrawer(Gravity.LEFT); } else { if ((System.currentTimeMillis() - DOUBLE_CLICK_TIME) > 2000) { showToast(getString(R.string.double_click_exit)); DOUBLE_CLICK_TIME = System.currentTimeMillis(); } else { getBaseApplication().exitApp(); } } return true; } return super.onKeyDown(keyCode, event); }
From source file:com.keylesspalace.tusky.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_MENU: { if (drawer.isDrawerOpen()) { drawer.closeDrawer();//from w ww . ja v a 2 s .c om } else { drawer.openDrawer(); } return true; } case KeyEvent.KEYCODE_SEARCH: { startActivityWithSlideInAnimation(new Intent(this, SearchActivity.class)); return true; } } return super.onKeyDown(keyCode, event); }