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:org.zywx.wbpalmstar.engine.EBrowserActivity.java
@Override public final boolean onKeyUp(int keyCode, KeyEvent event) { if (!mKeyDown) { return true; }/* w w w . j ava 2 s. c o m*/ mKeyDown = false; switch (keyCode) { case KeyEvent.KEYCODE_BACK: if (customViewShown()) { hideCustomView(); } else { giveKeyEnventToBrowser(); } return true; case KeyEvent.KEYCODE_MENU: if (mBrowser.isLockMenuKey() && !mBrowser.isSpaceShown()) { mBrowser.onAppKeyPress(EUExCallback.F_C_Key_Menu); return true; } break; } return super.onKeyUp(keyCode, event); }
From source file:com.jwork.spycamera.MainFragment.java
public boolean onKeyDown(int keyCode, KeyEvent event) { log.v(this, "onKeyDown(keycode:" + keyCode + ")"); if (keyCode == KeyEvent.KEYCODE_BACK) { return controller.pressBack(); } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { return controller.pressVolumeDown(); // //TODO // LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.linearLayoutPreview); // linearLayout.removeView(svPreview); // return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { return controller.pressVolumeUp(); // //TODO // LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.linearLayoutPreview); // linearLayout.addView(svPreview, 1); // return true; } else if (keyCode == KeyEvent.KEYCODE_MENU) { return controller.pressMenu(); }/*from ww w . jav a 2s .c o m*/ return false; }
From source file:com.mjhram.geodata.GpsMainActivity.java
public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { ToggleDrawer();/*from ww w. jav a2s.com*/ } return super.onKeyUp(keyCode, event); }
From source file:org.telegram.ui.ActionBar.ActionBarMenuItem.java
public void toggleSubMenu() { if (popupLayout == null) { return;/*w w w. j a va 2s. com*/ } if (showMenuRunnable != null) { AndroidUtilities.cancelRunOnUIThread(showMenuRunnable); showMenuRunnable = null; } if (popupWindow != null && popupWindow.isShowing()) { popupWindow.dismiss(); return; } if (popupWindow == null) { popupWindow = new ActionBarPopupWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT); if (Build.VERSION.SDK_INT >= 19) { popupWindow.setAnimationStyle(0); } else { popupWindow.setAnimationStyle(R.style.PopupAnimation); } popupWindow.setOutsideTouchable(true); popupWindow.setClippingEnabled(true); popupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); popupLayout.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), MeasureSpec.AT_MOST)); popupWindow.getContentView().setFocusableInTouchMode(true); popupWindow.getContentView().setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0 && event.getAction() == KeyEvent.ACTION_UP && popupWindow != null && popupWindow.isShowing()) { popupWindow.dismiss(); return true; } return false; } }); } processedPopupClick = false; popupWindow.setFocusable(true); if (popupLayout.getMeasuredWidth() == 0) { updateOrShowPopup(true, true); } else { updateOrShowPopup(true, false); } popupWindow.startAnimation(); }
From source file:ca.mudar.parkcatcher.ui.activities.MainActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (mMapFragment != null) { if (keyCode == KeyEvent.KEYCODE_MENU) { mMapFragment.searchToggle(false); } else if (keyCode == KeyEvent.KEYCODE_SEARCH) { mMapFragment.searchToggle(true); }/*from w w w .j a va 2s . c o m*/ } return super.onKeyUp(keyCode, event); }
From source file:im.vector.activity.ImageWebViewActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { // This is to fix a bug in the v7 support lib. If there is no options menu and you hit MENU, it will crash with a // NPE @ android.support.v7.app.ActionBarImplICS.getThemedContext(ActionBarImplICS.java:274) // This can safely be removed if we add in menu options on this screen return true; }/*from w w w . ja va2 s . c om*/ return super.onKeyDown(keyCode, event); }
From source file:org.apache.cordova.X5CordovaWebViewImpl.java
@Override public void setButtonPlumbedToJs(int keyCode, boolean override) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_MENU: // TODO: Why are search and menu buttons handled separately? if (override) { boundKeyCodes.add(keyCode);/*from w w w .java 2 s . co m*/ } else { boundKeyCodes.remove(keyCode); } return; default: throw new IllegalArgumentException("Unsupported keycode: " + keyCode); } }
From source file:org.ulteo.ovd.AndRdpActivity.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { AudioManager audioManager;/* w w w. j av a 2s .c o m*/ if (Config.DEBUG) Log.i(Config.TAG, "AndRdpActivity.dispatchKeyEvent " + event); // Disable keypress if it is from a mouse or touchpad. if (event.getDeviceId() >= 0) { InputDevice dev = InputDevice.getDevice(event.getDeviceId()); if (dev.getSources() == InputDevice.SOURCE_MOUSE || dev.getSources() == InputDevice.SOURCE_TOUCHPAD) return true; } if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_MENU: OnThreeFingers(null); return true; case KeyEvent.KEYCODE_BACK: Log.i(Config.TAG, "Back key pressed"); askLogoutDialog(); return true; case KeyEvent.KEYCODE_VOLUME_UP: audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; } } else if (event.getAction() == KeyEvent.ACTION_UP) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_MENU: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: return true; } } if (isLoggedIn() && rdp.dispatchKeyEvent(event)) return true; return super.dispatchKeyEvent(event); }
From source file:bander.notepad.NoteEditAppCompat.java
public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar.isOverflowMenuShowing()) { toolbar.dismissPopupMenus(); } else {//from w w w .j a va2 s .c om toolbar.showOverflowMenu(); } return true; } return super.onKeyUp(keyCode, event); }