List of usage examples for android.view KeyEvent KEYCODE_VOLUME_DOWN
int KEYCODE_VOLUME_DOWN
To view the source code for android.view KeyEvent KEYCODE_VOLUME_DOWN.
Click Source Link
From source file:com.android.launcher2.Launcher.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_HOME: return true; case KeyEvent.KEYCODE_VOLUME_DOWN: if (isPropertyEnabled(DUMP_STATE_PROPERTY)) { dumpState();/*from w w w .ja v a2 s . com*/ return true; } break; } } else if (event.getAction() == KeyEvent.ACTION_UP) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_HOME: return true; } } return super.dispatchKeyEvent(event); }
From source file:com.gxapplications.android.gxsuite.launcher.Launcher.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_HOME: return true; case KeyEvent.KEYCODE_VOLUME_DOWN: if (doesFileExist(DUMP_STATE_PROPERTY)) { dumpState();//from w w w .ja va 2 s . c o m return true; } break; } } else if (event.getAction() == KeyEvent.ACTION_UP) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_HOME: return true; } } return super.dispatchKeyEvent(event); }
From source file:com.plusot.senselib.SenseMain.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { final int action = event.getAction(); final int keyCode = event.getKeyCode(); boolean result = false; if ((lastAction == action && lastKeyCode == keyCode)) { switch (keyCode) { case KeyEvent.KEYCODE_CAMERA: newInterval();// w ww . ja v a 2 s .c om break; case KeyEvent.KEYCODE_POWER: //if (action == KeyEvent.) LLog.d(Globals.TAG, CLASSTAG + " Power button pressed"); break; case KeyEvent.KEYCODE_VOLUME_UP: if (action == KeyEvent.ACTION_DOWN) { dimScreen(true); } result = true; break; case KeyEvent.KEYCODE_VOLUME_DOWN: if (action == KeyEvent.ACTION_DOWN) { dimScreen(false); } result = true; break; } } else { AudioManager mgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE); switch (keyCode) { case KeyEvent.KEYCODE_CAMERA: newInterval(); break; case KeyEvent.KEYCODE_VOLUME_UP: if (sameActionKeyCode < 2 && lastAction == KeyEvent.ACTION_DOWN && action == KeyEvent.ACTION_UP && lastKeyCode == KeyEvent.KEYCODE_VOLUME_UP) { mgr.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND); } result = true; break; case KeyEvent.KEYCODE_VOLUME_DOWN: if (sameActionKeyCode < 2 && lastAction == KeyEvent.ACTION_DOWN && action == KeyEvent.ACTION_UP && lastKeyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { mgr.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND); } result = true; break; } } if (!result) { // LLog.d(Globals.TAG, CLASSTAG + // ".distpatchKeyEvent: Calling super with " + delta); result = super.dispatchKeyEvent(event); } if (lastAction == action && lastKeyCode == keyCode) { sameActionKeyCode++; } else sameActionKeyCode = 0; lastKeyCode = keyCode; lastAction = action; return result; }
From source file:org.telegram.ui.Components.ChatAttachAlert.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (cameraOpened && (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) { shutterButton.getDelegate().shutterReleased(); return true; }/* w w w . ja va 2 s.c o m*/ return super.onKeyDown(keyCode, event); }
From source file:com.android.launcher3.Launcher.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_HOME: return true; case KeyEvent.KEYCODE_VOLUME_DOWN: if (Utilities.isPropertyEnabled(DUMP_STATE_PROPERTY)) { dumpState();//w ww.j av a 2 s .c o m return true; } break; } } else if (event.getAction() == KeyEvent.ACTION_UP) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_HOME: return true; } } return super.dispatchKeyEvent(event); }
From source file:com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.java
/** * Clients can call this method to delegate handling of the volume. Clients should override * {@code dispatchEvent} and call this method: * <pre>/*w w w . ja va2s . co m*/ public boolean dispatchKeyEvent(KeyEvent event) { if (mCastManager.onDispatchVolumeKeyEvent(event, VOLUME_DELTA)) { return true; } return super.dispatchKeyEvent(event); } * </pre> * @param event The dispatched event. * @param volumeDelta The amount by which volume should be increased or decreased in each step * @return <code>true</code> if volume is handled by the library, <code>false</code> otherwise. */ public boolean onDispatchVolumeKeyEvent(KeyEvent event, double volumeDelta) { if (isConnected()) { boolean isKeyDown = event.getAction() == KeyEvent.ACTION_DOWN; switch (event.getKeyCode()) { case KeyEvent.KEYCODE_VOLUME_UP: if (changeVolume(volumeDelta, isKeyDown)) { return true; } break; case KeyEvent.KEYCODE_VOLUME_DOWN: if (changeVolume(-volumeDelta, isKeyDown)) { return true; } break; } } return false; }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
/** * Handle hotkeys// ww w .java 2 s . co m * * <p> * This method is called by {@link #dispatchKeyEvent(KeyEvent)} before any * view had the chance to consume this key event. * </p> * * @param keyCode * The value in {@code event.getKeyCode()}. * @param event * Description of the key event. * * @return {@code true} if this event was consumed. */ public boolean onCustomKeyDown(final int keyCode, final KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: { if (mMessageViewFragment != null && mDisplayMode != DisplayMode.MESSAGE_LIST && K9.useVolumeKeysForNavigationEnabled()) { showPreviousMessage(); return true; } else if (mDisplayMode != DisplayMode.MESSAGE_VIEW && K9.useVolumeKeysForListNavigationEnabled()) { mMessageListFragment.onMoveUp(); return true; } break; } case KeyEvent.KEYCODE_VOLUME_DOWN: { if (mMessageViewFragment != null && mDisplayMode != DisplayMode.MESSAGE_LIST && K9.useVolumeKeysForNavigationEnabled()) { showNextMessage(); return true; } else if (mDisplayMode != DisplayMode.MESSAGE_VIEW && K9.useVolumeKeysForListNavigationEnabled()) { mMessageListFragment.onMoveDown(); return true; } break; } case KeyEvent.KEYCODE_C: { mMessageListFragment.onCompose(); return true; } case KeyEvent.KEYCODE_Q: { if (mMessageListFragment != null && mMessageListFragment.isSingleAccountMode()) { onShowFolderList(); } return true; } case KeyEvent.KEYCODE_O: { mMessageListFragment.onCycleSort(); return true; } case KeyEvent.KEYCODE_I: { mMessageListFragment.onReverseSort(); return true; } case KeyEvent.KEYCODE_DEL: case KeyEvent.KEYCODE_D: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onDelete(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onDelete(); } return true; } case KeyEvent.KEYCODE_S: { mMessageListFragment.toggleMessageSelect(); return true; } case KeyEvent.KEYCODE_G: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onToggleFlagged(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onToggleFlagged(); } return true; } case KeyEvent.KEYCODE_M: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onMove(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onMove(); } return true; } case KeyEvent.KEYCODE_V: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onArchive(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onArchive(); } return true; } case KeyEvent.KEYCODE_Y: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onCopy(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onCopy(); } return true; } case KeyEvent.KEYCODE_Z: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onToggleRead(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onToggleRead(); } return true; } case KeyEvent.KEYCODE_F: { if (mMessageViewFragment != null) { mMessageViewFragment.onForward(); } return true; } case KeyEvent.KEYCODE_A: { if (mMessageViewFragment != null) { mMessageViewFragment.onReplyAll(); } return true; } case KeyEvent.KEYCODE_R: { if (mMessageViewFragment != null) { mMessageViewFragment.onReply(); } return true; } case KeyEvent.KEYCODE_J: case KeyEvent.KEYCODE_P: { if (mMessageViewFragment != null) { showPreviousMessage(); } return true; } case KeyEvent.KEYCODE_N: case KeyEvent.KEYCODE_K: { if (mMessageViewFragment != null) { showNextMessage(); } return true; } /* * FIXME case KeyEvent.KEYCODE_Z: { mMessageViewFragment.zoom(event); * return true; } */ case KeyEvent.KEYCODE_H: { Toast toast = Toast.makeText(this, R.string.message_list_help_key, Toast.LENGTH_LONG); toast.show(); return true; } } return false; }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { // Swallow these events too to avoid the audible notification of a // volume change if (K9.useVolumeKeysForListNavigationEnabled()) { if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) { if (K9.DEBUG) Log.v(K9.LOG_TAG, "Swallowed key up."); return true; }// w w w . j a va2 s . c om } return super.onKeyUp(keyCode, event); }
From source file:com.rfo.basic.Run.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // The user hit a key // Log.v(LOGTAG, "onKeyDown" + keyCode); // Eat the MENU key Down event, will handle the Up event. if (keyCode == KeyEvent.KEYCODE_MENU) return true; // If event is null, we called this directly from runLoop(), // so the return value does not matter. if (event == null) return true; // Alternate: if the user program has set mBlockVolKeys, block everything but BACK // if (mBlockVolKeys && (keyCode != KeyEvent.KEYCODE_BACK)) return true; // If the user program has set mBlockVolKeys, block volume and headset keys. if (mBlockVolKeys && ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) || (keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) || (keyCode == KeyEvent.KEYCODE_MUTE) || (keyCode == KeyEvent.KEYCODE_HEADSETHOOK))) { return true; }/* w w w.j a v a 2s. c om*/ // Otherwise pass the KeyEvent up the chain. return super.onKeyDown(keyCode, event); }