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.google.android.marvin.mytalkback.ProcessorVolumeStream.java
private boolean attemptEditTextNavigation(int keyCode) { AccessibilityNodeInfoCompat currentNode = mCursorController.getCursor(); try {//w w w.j a v a 2s .com if ((currentNode == null) || !AccessibilityNodeInfoUtils.nodeMatchesClassByType(mContext, currentNode, android.widget.EditText.class)) { return false; } final CursorGranularity currentGranularity = mCursorController.getGranularityAt(currentNode); if (currentGranularity == CursorGranularity.DEFAULT) { mCursorController.setGranularity(CursorGranularity.CHARACTER, false /* fromUser */); } if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { return mCursorController.next(false /* shouldWrap */, false /* shouldScroll */); } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { return mCursorController.previous(false /* shouldWarp */, false /* shouldScroll */); } return false; } finally { AccessibilityNodeInfoUtils.recycleNodes(currentNode); } }
From source file:com.audiokernel.euphonyrmt.library.SimpleLibraryActivity.java
@Override public boolean onKeyUp(final int keyCode, @NonNull final KeyEvent event) { boolean result = true; if (event.isTracking() && !event.isCanceled() && !mApp.isLocalAudible()) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: MPDControl.run(MPDControl.ACTION_VOLUME_STEP_UP); break; case KeyEvent.KEYCODE_VOLUME_DOWN: MPDControl.run(MPDControl.ACTION_VOLUME_STEP_DOWN); break; default://from w w w . j a v a2 s .c o m result = super.onKeyUp(keyCode, event); break; } } else { result = super.onKeyUp(keyCode, event); } return result; }
From source file:com.mplayer_remote.RemoteControl.java
/** * Metoda wywoywana w reakcji na wciniecie, ktrego z przyciskw fizycznych urzdzenia. * W tym wypadku definiuje akcje wykonywane, kiedy uytkownik wcinie przycisk poganiania i przyciszania. * @see android.app.Activity#onKeyDown(int, android.view.KeyEvent) *//* w ww .j av a 2 s. c o m*/ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { super.onKeyUp(keyCode, event); //onBackPressed(); if ((keyCode == KeyEvent.KEYCODE_BACK)) onBackPressed(); if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP)) { if (mBound == true) { mConnectAndPlayService.sendCommand("echo key_down_event 42 > fifofile"); } return true; //because I handled the event } if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) { if (mBound == true) { mConnectAndPlayService.sendCommand("echo key_down_event 47 > fifofile"); } return true; //because I handled the event } return false; //otherwise the system can handle it }
From source file:com.nextgis.rehacompdemo.RoutingActivity.java
@Override public boolean dispatchKeyEvent(@NonNull KeyEvent event) { int position; int action = event.getAction(); int keyCode = event.getKeyCode(); switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: if (action == KeyEvent.ACTION_DOWN) { position = mSteps.getSelectedItemPosition(); if (position == AdapterView.INVALID_POSITION) position = 0;//from ww w. j av a 2 s.co m else position--; mSteps.requestFocusFromTouch(); mSteps.setSelection(position); break; } else return true; case KeyEvent.KEYCODE_VOLUME_DOWN: if (action == KeyEvent.ACTION_DOWN) { position = mSteps.getSelectedItemPosition(); if (position == AdapterView.INVALID_POSITION) position = 0; else position++; mSteps.requestFocusFromTouch(); mSteps.setSelection(position); break; } else return true; default: return super.dispatchKeyEvent(event); } return true; }
From source file:co.jlabs.cersei_retailer.zxingfragmentlib.BarCodeScannerFragment.java
public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { 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); setTorchOff();/* w w w . j av a2s . c o m*/ return true; case KeyEvent.KEYCODE_VOLUME_UP: setTorchOn(); return true; } return false; //super.onKeyDown(keyCode, event); }
From source file:net.reichholf.dreamdroid.fragment.helper.DreamDroidHttpFragmentHelper.java
public boolean onKeyDown(int keyCode, KeyEvent event) { if (PreferenceManager.getDefaultSharedPreferences(getActionBarActivity()).getBoolean("volume_control", false)) {/* w w w .j ava 2 s . c o m*/ switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: onVolumeButtonClicked(Volume.CMD_UP); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: onVolumeButtonClicked(Volume.CMD_DOWN); return true; } } return false; }
From source file:net.reichholf.dreamdroid.fragment.helper.DreamDroidHttpFragmentHelper.java
public boolean onKeyUp(int keyCode, KeyEvent event) { return keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || false; }
From source file:com.google.android.marvin.talkback.ProcessorVolumeStream.java
private boolean attemptEditTextNavigation(int keyCode) { AccessibilityNodeInfoCompat currentNode = mCursorController.getCursor(); try {/* w ww .j ava 2s.c om*/ if ((currentNode == null) || !AccessibilityNodeInfoUtils.nodeMatchesClassByType(mContext, currentNode, android.widget.EditText.class)) { return false; } final CursorGranularity currentGranularity = mCursorController.getGranularityAt(currentNode); if (currentGranularity == CursorGranularity.DEFAULT) { mCursorController.setGranularity(CursorGranularity.CHARACTER, false /* fromUser */); } boolean result = false; if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { result = mCursorController.next(false /* shouldWrap */, false /* shouldScroll */); } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { result = mCursorController.previous(false /* shouldWarp */, false /* shouldScroll */); } if (!result) { mFeedbackController.playAuditory(R.id.sounds_complete); } // Consume the key event, even if navigation in the EditText failed return true; } finally { AccessibilityNodeInfoUtils.recycleNodes(currentNode); } }
From source file:piuk.blockchain.android.ui.zxing.CaptureActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: setResult(RESULT_CANCELED);/*from w w w. j a v a 2s. com*/ finish(); 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); }