List of usage examples for android.view KeyEvent KEYCODE_CAMERA
int KEYCODE_CAMERA
To view the source code for android.view KeyEvent KEYCODE_CAMERA.
Click Source Link
From source file:de.pixart.messenger.ui.ScanActivity.java
@Override public boolean onKeyDown(final int keyCode, final KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_FOCUS: case KeyEvent.KEYCODE_CAMERA: // don't launch camera app return true; case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: cameraHandler.post(() -> cameraManager.setTorch(keyCode == KeyEvent.KEYCODE_VOLUME_UP)); return true; }// w w w. j av a 2s .co m return super.onKeyDown(keyCode, event); }
From source file:zxing.util.CaptureActivity.java
License:asdf
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: Intent intent = new Intent(); if (lastResult != null) { intent.putExtra("BarCode", lastResult); setResult(RESULT_OK, intent); finish();/*w ww . j a va 2 s . c o m*/ return true; } else { restartPreviewAfterDelay(0L); 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:tw.jwzhuang.ipcamviewer.devices.CaptureActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (source == IntentSource.NATIVE_APP_INTENT) { setResult(RESULT_CANCELED);//w w w . j av a 2s .c o m finish(); return true; } else if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) { restartPreviewAfterDelay(0L); return true; } } else if (keyCode == KeyEvent.KEYCODE_FOCUS || keyCode == KeyEvent.KEYCODE_CAMERA) { // Handle these events so they don't launch the Camera app return true; } return super.onKeyDown(keyCode, event); }
From source file:org.madmatrix.zxing.android.CaptureActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: // ? if ((source == IntentSource.NONE) && lastResult != null) { restartPreviewAfterDelay(0L); return true; }//from ww w. ja v a 2 s . c om 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:freed.cam.ActivityFreeDcamMain.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (activityIsResumed) { Log.d(TAG, "KeyCode Pressed:" + keyCode); int appSettingsKeyShutter = 0; if (getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER).equals(StringUtils.VoLP)) appSettingsKeyShutter = KeyEvent.KEYCODE_VOLUME_UP; else if (getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER) .equals(StringUtils.VoLM)) appSettingsKeyShutter = KeyEvent.KEYCODE_VOLUME_DOWN; else if (getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER) .equals(StringUtils.Hook) || getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER).equals("")) appSettingsKeyShutter = KeyEvent.KEYCODE_HEADSETHOOK; if (keyCode == KeyEvent.KEYCODE_3D_MODE || keyCode == KeyEvent.KEYCODE_POWER || keyCode == appSettingsKeyShutter || keyCode == KeyEvent.KEYCODE_UNKNOWN || keyCode == KeyEvent.KEYCODE_CAMERA) { cameraFragment.GetModuleHandler().DoWork(); return true; }// w w w . jav a 2 s . c o m if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) { closeActivity(); return true; } } return super.onKeyDown(keyCode, event); }
From source file:com.google.zxing.client.android.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);/*w w w . j a v a 2 s.c o m*/ finish(); 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:gov.nasa.arc.geocam.geocam.CameraActivity.java
public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_FOCUS: mFocusRect.setImageDrawable(getResources().getDrawable(R.drawable.frame_unfocused_64x48)); mLensIsFocused = false;//from w w w. j a v a 2 s . c o m break; case KeyEvent.KEYCODE_CAMERA: case KeyEvent.KEYCODE_DPAD_CENTER: mPictureTaken = false; break; } return super.onKeyUp(keyCode, event); }
From source file:com.stasbar.knowyourself.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); switch (keyEvent.getKeyCode()) { // Volume keys and camera keys dismiss the alarm. case KeyEvent.KEYCODE_POWER: 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 && keyEvent.getAction() == KeyEvent.ACTION_UP) { switch (mVolumeBehavior) { case SettingsActivity.VOLUME_BEHAVIOR_SNOOZE: snooze();/*from www .j a va 2s. co m*/ break; case SettingsActivity.VOLUME_BEHAVIOR_DISMISS: dismiss(); break; default: break; } } return true; default: return super.dispatchKeyEvent(keyEvent); } }
From source file:gov.nasa.arc.geocam.geocam.CameraActivity.java
public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_FOCUS: if (!mLensIsFocused) { mFocusRect.setImageDrawable(getResources().getDrawable(R.drawable.frame_unfocused_64x48)); mLensIsFocused = true;/*w w w . j av a 2 s.c om*/ this.focusLens(false); } break; case KeyEvent.KEYCODE_CAMERA: case KeyEvent.KEYCODE_DPAD_CENTER: if (!mPictureTaken) { mPictureTaken = true; if (!mLensIsFocused) { mFocusRect.setImageDrawable(getResources().getDrawable(R.drawable.frame_unfocused_64x48)); mLensIsFocused = true; this.focusLens(true); } else { this.takePicture(); } } // Return here after catching camera keycode so we don't launch the built-in camera app return true; } return super.onKeyDown(keyCode, event); }
From source file:com.android.deskclock.alarms.AlarmActivity.java
@Override public boolean dispatchKeyEvent(@NonNull KeyEvent keyEvent) { // Do this in dispatch to intercept a few of the system keys. LogUtils.v(LOGTAG, "dispatchKeyEvent: %s", keyEvent); switch (keyEvent.getKeyCode()) { // Volume keys and camera keys dismiss the alarm. case KeyEvent.KEYCODE_POWER: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_MUTE: case KeyEvent.KEYCODE_CAMERA: case KeyEvent.KEYCODE_FOCUS: if (!mAlarmHandled && keyEvent.getAction() == KeyEvent.ACTION_UP) { switch (mVolumeBehavior) { case SettingsActivity.VOLUME_BEHAVIOR_SNOOZE: snooze();/*from w w w . j a v a 2 s.c o m*/ break; case SettingsActivity.VOLUME_BEHAVIOR_DISMISS: dismiss(); break; default: break; } } return true; default: return super.dispatchKeyEvent(keyEvent); } }