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:org.liberty.android.fantastischmemo.ui.QACardActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (option.getVolumeKeyShortcut()) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { return true; }//from w ww. j ava2 s .com if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { return true; } } return super.onKeyDown(keyCode, event); }
From source file:com.audiokernel.euphonyrmt.MainMenuActivity.java
@Override public final boolean onKeyUp(final int keyCode, @NonNull final KeyEvent event) { boolean result = true; switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: if (event.isTracking() && !event.isCanceled() && !mApp.isLocalAudible()) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { MPDControl.run(MPDControl.ACTION_VOLUME_STEP_UP); } else { MPDControl.run(MPDControl.ACTION_VOLUME_STEP_DOWN); }/* w w w. jav a 2 s.c o m*/ } break; default: result = super.onKeyUp(keyCode, event); break; } return result; }
From source file:net.olejon.spotcommander.WebViewActivity.java
@Override public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: { event.startTracking();// w w w. j a v a 2 s .c o m return true; } case KeyEvent.KEYCODE_MENU: { return true; } case KeyEvent.KEYCODE_SEARCH: { return true; } case KeyEvent.KEYCODE_VOLUME_DOWN: { return true; } case KeyEvent.KEYCODE_VOLUME_UP: { return true; } default: { return super.onKeyDown(keyCode, event); } } }
From source file:org.liberty.android.fantastischmemo.ui.QACardActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (option.getVolumeKeyShortcut()) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { return onVolumeUpKeyPressed(); }/*from w ww. j av a 2s. c o m*/ if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { return onVolumeDownKeyPressed(); } } return super.onKeyUp(keyCode, event); }
From source file:com.app.azza.ocr.OcrCaptureActivity.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); Text text = null;/*w ww .j a va 2 s .co m*/ List mtextList = getAllGraphicsText(); switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: if (action == KeyEvent.ACTION_DOWN) { Toast toast = Toast.makeText(this, "volume up pressed", Toast.LENGTH_SHORT); toast.show(); Log.v("upVolume", "up " + lineNumberToSpeak); // for(Object block:textList){ // text=(Text)block; // // tts.speak(text.getValue(), TextToSpeech.QUEUE_ADD, null, "DEFAULT"); // } if (mtextList.size() > 0) { // for (int i = 0; i < textList.size(); i++) { if (lineNumberToSpeak < mtextList.size()) { text = (Text) mtextList.get(lineNumberToSpeak); if (text != null && text.getValue() != null) { tts.speak(text.getValue(), TextToSpeech.QUEUE_ADD, null, "DEFAULT"); if (lineNumberToSpeak < mtextList.size()) lineNumberToSpeak++; } else { Log.d(TAG, "text data is null"); } // } } else { // al list al gdeda lines feha 22al lineNumberToSpeak = 0; } } else { Log.d(TAG, "no text detected"); } } return true; case KeyEvent.KEYCODE_VOLUME_DOWN: if (action == KeyEvent.ACTION_DOWN) { Toast toast = Toast.makeText(this, "volume down pressed", Toast.LENGTH_SHORT); toast.show(); if (mtextList.size() > 0) { // for (int i = 0; i < textList.size(); i++) { if (lineNumberToSpeak > -1) { text = (Text) mtextList.get(lineNumberToSpeak); if (text != null && text.getValue() != null) { tts.speak(text.getValue(), TextToSpeech.QUEUE_ADD, null, "DEFAULT"); if (lineNumberToSpeak > 0) lineNumberToSpeak--; } else { Log.d(TAG, "text data is null"); } } else { lineNumberToSpeak = 0; } } else { Log.d(TAG, "no text detected"); } } return true; default: return super.dispatchKeyEvent(event); } }
From source file:com.piusvelte.webcaster.MainActivity.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: if (action == KeyEvent.ACTION_DOWN) { double currentVolume; if (mediaProtocolMessageStream != null) { currentVolume = mediaProtocolMessageStream.getVolume(); if (currentVolume < 1.0) { onSetVolume(currentVolume + VOLUME_INCREMENT); }/*from ww w . ja v a2 s .c o m*/ } else { Log.e(TAG, "dispatchKeyEvent - volume up - mMPMS==null"); } } return true; case KeyEvent.KEYCODE_VOLUME_DOWN: if (action == KeyEvent.ACTION_DOWN) { double currentVolume; if (mediaProtocolMessageStream != null) { currentVolume = mediaProtocolMessageStream.getVolume(); if (currentVolume > 0.0) { onSetVolume(currentVolume - VOLUME_INCREMENT); } } else { Log.e(TAG, "dispatchKeyEvent - volume down - mMPMS==null"); } } return true; default: return super.dispatchKeyEvent(event); } }
From source file:org.peterbaldwin.vlcremote.app.PlaybackActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { int c = event.getUnicodeChar(); if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { if (mVolumeLevel != VOLUME_LEVEL_UNKNOWN) { setVolume(mVolumeLevel + 20); } else {/*from w w w. j a v a2 s . com*/ mMediaServer.status().command.volumeUp(); } return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { if (mVolumeLevel != VOLUME_LEVEL_UNKNOWN) { setVolume(mVolumeLevel - 20); } else { mMediaServer.status().command.volumeDown(); } return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { if (event.isAltPressed()) { mMediaServer.status().command.seek(Uri.encode("-".concat(Preferences.get(this).getSeekTime()))); return true; } else if (event.isShiftPressed()) { mMediaServer.status().command.seek(Uri.encode("-3")); return true; } else { mMediaServer.status().command.key("nav-left"); return true; } } else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { if (event.isAltPressed()) { mMediaServer.status().command.seek(Uri.encode("+".concat(Preferences.get(this).getSeekTime()))); return true; } else if (event.isShiftPressed()) { mMediaServer.status().command.seek(Uri.encode("+3")); return true; } else { mMediaServer.status().command.key("nav-right"); return true; } } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { mMediaServer.status().command.key("nav-up"); return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { mMediaServer.status().command.key("nav-down"); return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { mMediaServer.status().command.key("nav-activate"); return true; } else if (c == ' ') { mMediaServer.status().command.playback.pause(); return true; } else if (c == 's') { mMediaServer.status().command.playback.stop(); return true; } else if (c == 'p') { mMediaServer.status().command.playback.previous(); return true; } else if (c == 'n') { mMediaServer.status().command.playback.next(); return true; } else if (c == '+') { // TODO: Play faster return super.onKeyDown(keyCode, event); } else if (c == '-') { // TODO: Play slower return super.onKeyDown(keyCode, event); } else if (c == 'f') { mMediaServer.status().command.fullscreen(); return true; } else if (c == 'm') { mute(); return true; } else { return super.onKeyDown(keyCode, event); } }
From source file:org.apache.cordova.AndroidWebView.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyDownCodes.contains(keyCode)) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { // only override default behavior is event bound LOG.d(TAG, "Down Key Hit"); this.loadUrl("javascript:cordova.fireDocumentEvent('volumedownbutton');"); return true; }//from www.j a va 2 s. co m // If volumeup key else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { LOG.d(TAG, "Up Key Hit"); this.loadUrl("javascript:cordova.fireDocumentEvent('volumeupbutton');"); return true; } else { return super.onKeyDown(keyCode, event); } } else if (keyCode == KeyEvent.KEYCODE_BACK) { return !(this.startOfHistory()) || this.bound; } else if (keyCode == KeyEvent.KEYCODE_MENU) { //How did we get here? Is there a childView? View childView = this.getFocusedChild(); if (childView != null) { //Make sure we close the keyboard if it's present InputMethodManager imm = (InputMethodManager) cordova.getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(childView.getWindowToken(), 0); cordova.getActivity().openOptionsMenu(); return true; } else { return super.onKeyDown(keyCode, event); } } return super.onKeyDown(keyCode, event); }
From source file:net.olejon.spotcommander.WebViewActivity.java
@Override public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_MENU: { mWebView.loadUrl("javascript:nativeAppAction('menu')"); return true; }/*w ww.j a v a2s. com*/ case KeyEvent.KEYCODE_SEARCH: { mWebView.loadUrl("javascript:nativeAppAction('search')"); return true; } case KeyEvent.KEYCODE_BACK: { if (mHasLongPressedBack) return true; if (mWebView.canGoBack() && mWebView.getUrl().contains("accounts.spotify.com/") || mWebView.canGoBack() && mWebView.getUrl().contains("facebook.com/")) { mWebView.goBack(); return true; } else if (mWebView.canGoBack() || mTools.getSharedPreferencesBoolean("CAN_CLOSE_COVER")) { mWebView.loadUrl("javascript:nativeAppAction('back')"); return true; } mTools.showToast(getString(R.string.webview_back), 1); return true; } case KeyEvent.KEYCODE_VOLUME_DOWN: { mWebView.loadUrl("javascript:nativeAppAction('volume_down')"); return true; } case KeyEvent.KEYCODE_VOLUME_UP: { mWebView.loadUrl("javascript:nativeAppAction('volume_up')"); return true; } default: { return super.onKeyUp(keyCode, event); } } }
From source file:com.ll.myapplication.vitamio.widget.VideoView.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL; if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) { if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE) { if (mMediaPlayer.isPlaying()) { pause();//from w w w. j ava 2 s . c o m mMediaController.show(); } else { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) { if (!mMediaPlayer.isPlaying()) { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) { if (mMediaPlayer.isPlaying()) { pause(); mMediaController.show(); } return true; } else { toggleMediaControlsVisiblity(); } } return super.onKeyDown(keyCode, event); }