List of usage examples for android.view KeyEvent KEYCODE_FOCUS
int KEYCODE_FOCUS
To view the source code for android.view KeyEvent KEYCODE_FOCUS.
Click Source Link
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; }/* w w w. ja v a 2 s. c o m*/ 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: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 a2s . 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;//w ww .ja va 2s . c o m break; case KeyEvent.KEYCODE_CAMERA: case KeyEvent.KEYCODE_DPAD_CENTER: mPictureTaken = false; break; } return super.onKeyUp(keyCode, event); }
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;/*from www . j a v a 2s . co m*/ 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.nekomeshi312.whiteboardcorrection.WhiteBoardCorrectionActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub switch (keyCode) { case KeyEvent.KEYCODE_FOCUS: if (mShutterStatus < SHUTTER_STATUS_FOCUS) { mShutterStatus = SHUTTER_STATUS_FOCUS; startAutoFocus();/* w ww . java2 s . com*/ } return true; case KeyEvent.KEYCODE_CAMERA: if (mShutterStatus < SHUTTER_STATUS_TAKEPIC) { if (mFocusStatus == FOCUS_STATUS_FOCUS_OK) { mShutterStatus = SHUTTER_STATUS_TAKEPIC; takePic(mCameraSetting.getCamera()); } else if (mFocusStatus == FOCUS_STATUS_FOCUSING) { mShutterStatus = SHUTTER_STATUS_TAKEPIC; } } return true; default: return super.onKeyDown(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 w w w.ja v a 2 s. c om*/ break; case SettingsActivity.VOLUME_BEHAVIOR_DISMISS: dismiss(); break; default: break; } } return true; default: return super.dispatchKeyEvent(keyEvent); } }
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 ww . jav a 2s. co m break; case SettingsActivity.VOLUME_BEHAVIOR_DISMISS: dismiss(); break; default: break; } } return true; default: return super.dispatchKeyEvent(keyEvent); } }
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 a2 s.c o m*/ } return true; case DISMISS: if (keyEvent.getAction() == KeyEvent.ACTION_UP) { dismiss(); } return true; } } } return super.dispatchKeyEvent(keyEvent); }
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);/*from w ww . j av a2 s . c o m*/ 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:com.nekomeshi312.whiteboardcorrection.WhiteBoardCorrectionActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { // TODO Auto-generated method stub switch (keyCode) { case KeyEvent.KEYCODE_FOCUS: if (mShutterStatus < SHUTTER_STATUS_TAKEN) { mShutterStatus = SHUTTER_STATUS_IDLE; mFocusStatus = FOCUS_STATUS_IDLE; }/* w w w. ja v a 2s. c om*/ return true; case KeyEvent.KEYCODE_CAMERA: default: return super.onKeyUp(keyCode, event); } }