List of usage examples for android.view KeyEvent KEYCODE_VOLUME_UP
int KEYCODE_VOLUME_UP
To view the source code for android.view KeyEvent KEYCODE_VOLUME_UP.
Click Source Link
From source file:org.xbmc.android.remote.presentation.activity.MovieLibraryActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { IEventClientManager client = ManagerFactory.getEventClientManager(mMovieController); switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: client.sendButton("R1", ButtonCodes.REMOTE_VOLUME_PLUS, false, true, true, (short) 0, (byte) 0); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: client.sendButton("R1", ButtonCodes.REMOTE_VOLUME_MINUS, false, true, true, (short) 0, (byte) 0); return true; }/*from w w w . j a v a2 s .co m*/ client.setController(null); return super.onKeyDown(keyCode, event); }
From source file:com.androidinspain.deskclock.alarms.AlarmActivity.java
@Override public boolean dispatchKeyEvent(@NonNull KeyEvent keyEvent) { // Do this in dispatch to intercept a few of the system keys. LOGGER.v("dispatchKeyEvent: %s", keyEvent); final int keyCode = keyEvent.getKeyCode(); switch (keyCode) { // Volume keys and camera keys dismiss the alarm. case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_CAMERA: case KeyEvent.KEYCODE_FOCUS: if (!mAlarmHandled) { switch (mVolumeBehavior) { case SNOOZE: if (keyEvent.getAction() == KeyEvent.ACTION_UP) { snooze();//from w ww .j av a 2 s.c om } return true; case DISMISS: if (keyEvent.getAction() == KeyEvent.ACTION_UP) { dismiss(); } return true; } } } return super.dispatchKeyEvent(keyEvent); }
From source file:de.qspool.clementineremote.ui.MainActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent keyEvent) { if (mSharedPref.getBoolean(App.SP_KEY_USE_VOLUMEKEYS, true)) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) { return true; }/*ww w . ja va 2 s . c om*/ } return super.onKeyUp(keyCode, keyEvent); }
From source file:org.libreoffice.impressremote.activity.SlideShowActivity.java
@Override public boolean onKeyDown(int aKeyCode, KeyEvent aKeyEvent) { if (!areVolumeKeysActionsRequired()) { return super.onKeyDown(aKeyCode, aKeyEvent); }//from w w w . j a v a 2s . c o m switch (aKeyCode) { case KeyEvent.KEYCODE_VOLUME_UP: if (!isLastSlideDisplayed()) { mCommunicationService.getCommandsTransmitter().performNextTransition(); } return true; case KeyEvent.KEYCODE_VOLUME_DOWN: mCommunicationService.getCommandsTransmitter().performPreviousTransition(); return true; default: return super.onKeyDown(aKeyCode, aKeyEvent); } }
From source file:org.chromium.chrome.browser.media.remote.ExpandedControllerActivity.java
/** * Modify remote volume by handling volume keys. * * @param controller The remote controller through which the volume will be modified. * @param event The key event. Its keycode needs to be either {@code KEYCODE_VOLUME_DOWN} or * {@code KEYCODE_VOLUME_UP} otherwise this method will return false. * @return True if the event is handled. */// w ww . j a va 2s. c om private boolean handleVolumeKeyEvent(MediaRouteController controller, KeyEvent event) { if (!controller.isBeingCast()) return false; int action = event.getAction(); int keyCode = event.getKeyCode(); // Intercept the volume keys to affect only remote volume. switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_DOWN: if (action == KeyEvent.ACTION_DOWN) controller.setRemoteVolume(-1); return true; case KeyEvent.KEYCODE_VOLUME_UP: if (action == KeyEvent.ACTION_DOWN) controller.setRemoteVolume(1); return true; default: return false; } }
From source file:aarddict.android.ArticleViewActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: goBack();//from w ww .j a v a 2 s . c o m break; case NOOK_KEY_PREV_LEFT: case NOOK_KEY_PREV_RIGHT: case KeyEvent.KEYCODE_VOLUME_UP: if (!articleView.pageUp(false)) { goBack(); } break; case KeyEvent.KEYCODE_VOLUME_DOWN: case NOOK_KEY_NEXT_LEFT: case NOOK_KEY_NEXT_RIGHT: if (!articleView.pageDown(false)) { nextArticle(); } ; break; default: return super.onKeyDown(keyCode, event); } return true; }
From source file:com.cleverzone.zhizhi.capture.CaptureActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: if (source == IntentSource.NATIVE_APP_INTENT) { setResult(RESULT_CANCELED);// ww w . j av a2 s . c om finish(); return true; } if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) { restartPreviewAfterDelay(0L); return true; } break; case KeyEvent.KEYCODE_FOCUS: case KeyEvent.KEYCODE_CAMERA: // Handle these events so they don't launch the Camera app return true; // Use volume up/down to turn on light case KeyEvent.KEYCODE_VOLUME_DOWN: cameraManager.setTorch(false); return true; case KeyEvent.KEYCODE_VOLUME_UP: cameraManager.setTorch(true); return true; } return super.onKeyDown(keyCode, event); }
From source file:org.apache.cordova.CordovaWebViewImpl.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: // TODO: Why are search and menu buttons handled separately? if (override) { boundKeyCodes.add(keyCode);//from w ww .j a va 2 s. co m } else { boundKeyCodes.remove(keyCode); } return; default: throw new IllegalArgumentException("Unsupported keycode: " + keyCode); } }
From source file:org.apache.cordova.engine.crosswalk.XWalkCordovaWebView.java
@Override public void setButtonPlumbedToJs(int keyCode, boolean value) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_BACK: // TODO: Why are search and menu buttons handled separately? boundKeyCodes.add(keyCode);/*from w ww .j ava 2 s .co m*/ return; default: throw new IllegalArgumentException("Unsupported keycode: " + keyCode); } }
From source file:edu.stanford.mobisocial.dungbeetle.ui.fragments.AppsViewFragment.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { event.startTracking();//from ww w. ja v a 2 s . com return true; } if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { event.startTracking(); return true; } if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK) { Intent record = new Intent(getActivity(), VoiceQuickRecordActivity.class); record.putExtra("feed_uri", mFeedUri); startActivity(record); return true; } return false; }