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: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 w w . java 2 s . c om*/ } 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.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();// ww w . j a v a2s.co 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 w w. j av a 2 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 . j a va 2s. c om*/ return true; case KeyEvent.KEYCODE_CAMERA: default: return super.onKeyUp(keyCode, event); } }
From source file:app.axe.imooc.zxing.app.CaptureActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (source == Source.NATIVE_APP_INTENT) { setResult(RESULT_CANCELED);//from w ww . j a v a 2 s . com finish(); return true; } else if ((source == Source.NONE || source == Source.ZXING_LINK) && lastResult != null) { resetStatusView(); if (handler != null) { handler.sendEmptyMessage(R.id.restart_preview); } 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:ca.nehil.rter.streamingapp.StreamingActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (recording) { stopRecording();// w ww . j a v a 2s . c om } finish(); return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { createBeacon(); } else if (keyCode == KeyEvent.KEYCODE_CAMERA) { // Camera button clicked. } return super.onKeyDown(keyCode, event); }
From source file:org.appcelerator.titanium.TiBaseActivity.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { boolean handled = false; TiViewProxy window;//from w ww. j a v a 2 s . c o m if (this.window != null) { window = this.window; } else { window = this.view; } if (window == null) { return super.dispatchKeyEvent(event); } switch (event.getKeyCode()) { case KeyEvent.KEYCODE_BACK: { if (event.getAction() == KeyEvent.ACTION_UP) { String backEvent = "android:back"; KrollProxy proxy = null; //android:back could be fired from a tabGroup window (activityProxy) //or hw window (window).This event is added specifically to the activity //proxy of a tab group in window.js if (activityProxy.hasListeners(backEvent)) { proxy = activityProxy; } else if (window.hasListeners(backEvent)) { proxy = window; } if (proxy != null) { proxy.fireEvent(backEvent, null); handled = true; } } break; } case KeyEvent.KEYCODE_CAMERA: { if (window.hasListeners(TiC.EVENT_ANDROID_CAMERA)) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent(TiC.EVENT_ANDROID_CAMERA, null); } handled = true; } // TODO: Deprecate old event if (window.hasListeners("android:camera")) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent("android:camera", null); } handled = true; } break; } case KeyEvent.KEYCODE_FOCUS: { if (window.hasListeners(TiC.EVENT_ANDROID_FOCUS)) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent(TiC.EVENT_ANDROID_FOCUS, null); } handled = true; } // TODO: Deprecate old event if (window.hasListeners("android:focus")) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent("android:focus", null); } handled = true; } break; } case KeyEvent.KEYCODE_SEARCH: { if (window.hasListeners(TiC.EVENT_ANDROID_SEARCH)) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent(TiC.EVENT_ANDROID_SEARCH, null); } handled = true; } // TODO: Deprecate old event if (window.hasListeners("android:search")) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent("android:search", null); } handled = true; } break; } case KeyEvent.KEYCODE_VOLUME_UP: { if (window.hasListeners(TiC.EVENT_ANDROID_VOLUP)) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent(TiC.EVENT_ANDROID_VOLUP, null); } handled = true; } // TODO: Deprecate old event if (window.hasListeners("android:volup")) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent("android:volup", null); } handled = true; } break; } case KeyEvent.KEYCODE_VOLUME_DOWN: { if (window.hasListeners(TiC.EVENT_ANDROID_VOLDOWN)) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent(TiC.EVENT_ANDROID_VOLDOWN, null); } handled = true; } // TODO: Deprecate old event if (window.hasListeners("android:voldown")) { if (event.getAction() == KeyEvent.ACTION_UP) { window.fireEvent("android:voldown", null); } handled = true; } break; } } if (!handled) { handled = super.dispatchKeyEvent(event); } return handled; }
From source file:com.bookkos.bircle.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 w w . j av a 2 s .co 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: 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); }