Java Code Examples for android.view.KeyEvent#getScanCode()
The following examples show how to use
android.view.KeyEvent#getScanCode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransitionActivity.java From ifican with Apache License 2.0 | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.d("IFICAN", "onKeyDown: " + keyCode + " - event: " + event); if (keyCode == 0) { int scanCode = event.getScanCode(); switch (scanCode) { case IfICan.BUTTON_NEXT: onNextPressed(); break; case IfICan.BUTTON_PREV: onBackPressed(); break; } } return super.onKeyDown(keyCode, event); }
Example 2
Source File: MainActivity.java From ifican with Apache License 2.0 | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.d("IFICAN", "onKeyDown: " + keyCode + " - event: " + event); BaseFragment fragment = (BaseFragment) getFragmentManager().findFragmentByTag("current"); if (keyCode == 0) { int scanCode = event.getScanCode(); switch (scanCode) { case IfICan.BUTTON_NEXT: fragment.onNextPressed(); break; case IfICan.BUTTON_PREV: fragment.onPrevPressed(); break; } } return super.onKeyDown(keyCode, event); }
Example 3
Source File: Instrumentation.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
/** * Send a key event to the currently focused window/view and wait for it to * be processed. Finished at some point after the recipient has returned * from its event processing, though it may <em>not</em> have completely * finished reacting from the event -- for example, if it needs to update * its display as a result, it may still be in the process of doing that. * * @param event The event to send to the current focus. */ public void sendKeySync(KeyEvent event) { validateNotAppThread(); long downTime = event.getDownTime(); long eventTime = event.getEventTime(); int action = event.getAction(); int code = event.getKeyCode(); int repeatCount = event.getRepeatCount(); int metaState = event.getMetaState(); int deviceId = event.getDeviceId(); int scancode = event.getScanCode(); int source = event.getSource(); int flags = event.getFlags(); if (source == InputDevice.SOURCE_UNKNOWN) { source = InputDevice.SOURCE_KEYBOARD; } if (eventTime == 0) { eventTime = SystemClock.uptimeMillis(); } if (downTime == 0) { downTime = eventTime; } KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState, deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source); InputManager.getInstance().injectInputEvent(newEvent, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); }
Example 4
Source File: Instrumentation.java From droidel with Apache License 2.0 | 5 votes |
/** * Send a key event to the currently focused window/view and wait for it to * be processed. Finished at some point after the recipient has returned * from its event processing, though it may <em>not</em> have completely * finished reacting from the event -- for example, if it needs to update * its display as a result, it may still be in the process of doing that. * * @param event The event to send to the current focus. */ public void sendKeySync(KeyEvent event) { validateNotAppThread(); long downTime = event.getDownTime(); long eventTime = event.getEventTime(); int action = event.getAction(); int code = event.getKeyCode(); int repeatCount = event.getRepeatCount(); int metaState = event.getMetaState(); int deviceId = event.getDeviceId(); int scancode = event.getScanCode(); int source = event.getSource(); int flags = event.getFlags(); if (source == InputDevice.SOURCE_UNKNOWN) { source = InputDevice.SOURCE_KEYBOARD; } if (eventTime == 0) { eventTime = SystemClock.uptimeMillis(); } if (downTime == 0) { downTime = eventTime; } KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState, deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source); InputManager.getInstance().injectInputEvent(newEvent, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); }
Example 5
Source File: Instrumentation.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Send a key event to the currently focused window/view and wait for it to * be processed. Finished at some point after the recipient has returned * from its event processing, though it may <em>not</em> have completely * finished reacting from the event -- for example, if it needs to update * its display as a result, it may still be in the process of doing that. * * @param event The event to send to the current focus. */ public void sendKeySync(KeyEvent event) { validateNotAppThread(); long downTime = event.getDownTime(); long eventTime = event.getEventTime(); int action = event.getAction(); int code = event.getKeyCode(); int repeatCount = event.getRepeatCount(); int metaState = event.getMetaState(); int deviceId = event.getDeviceId(); int scancode = event.getScanCode(); int source = event.getSource(); int flags = event.getFlags(); if (source == InputDevice.SOURCE_UNKNOWN) { source = InputDevice.SOURCE_KEYBOARD; } if (eventTime == 0) { eventTime = SystemClock.uptimeMillis(); } if (downTime == 0) { downTime = eventTime; } KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState, deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source); InputManager.getInstance().injectInputEvent(newEvent, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); }
Example 6
Source File: Instrumentation.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
/** * Send a key event to the currently focused window/view and wait for it to * be processed. Finished at some point after the recipient has returned * from its event processing, though it may <em>not</em> have completely * finished reacting from the event -- for example, if it needs to update * its display as a result, it may still be in the process of doing that. * * @param event The event to send to the current focus. */ public void sendKeySync(KeyEvent event) { validateNotAppThread(); long downTime = event.getDownTime(); long eventTime = event.getEventTime(); int action = event.getAction(); int code = event.getKeyCode(); int repeatCount = event.getRepeatCount(); int metaState = event.getMetaState(); int deviceId = event.getDeviceId(); int scancode = event.getScanCode(); int source = event.getSource(); int flags = event.getFlags(); if (source == InputDevice.SOURCE_UNKNOWN) { source = InputDevice.SOURCE_KEYBOARD; } if (eventTime == 0) { eventTime = SystemClock.uptimeMillis(); } if (downTime == 0) { downTime = eventTime; } KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState, deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source); InputManager.getInstance().injectInputEvent(newEvent, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); }
Example 7
Source File: BaseActivity.java From TimeLapse with MIT License | 4 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { onAnyKeyUp(); switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyUp(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyUp(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyUp(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyUp(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyUp(); case ScalarInput.ISV_KEY_FN: return onFnKeyUp(); case ScalarInput.ISV_KEY_AEL: return onAelKeyUp(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyUp(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyUp(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyUp(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyUp(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyUp(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyUp(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyUp(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensDetached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return true; case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return true; case ScalarInput.ISV_KEY_MODE_DIAL: return true; default: return super.onKeyUp(keyCode, event); } }
Example 8
Source File: BaseActivity.java From STGUploader with MIT License | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyDown(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyDown(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyDown(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyDown(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyDown(); case ScalarInput.ISV_KEY_FN: return onFnKeyDown(); case ScalarInput.ISV_KEY_AEL: return onAelKeyDown(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyDown(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyDown(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyDown(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyDown(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyDown(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyDown(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyDown(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensAttached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return onUpperDialChanged(getDialStatus(ScalarInput.ISV_DIAL_1_STATUS) / 22); case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return onLowerDialChanged(getDialStatus(ScalarInput.ISV_DIAL_2_STATUS) / 22); case ScalarInput.ISV_KEY_MODE_DIAL: return onModeDialChanged(getDialStatus(ScalarInput.ISV_KEY_MODE_DIAL)); default: return super.onKeyDown(keyCode, event); } }
Example 9
Source File: BaseActivity.java From STGUploader with MIT License | 4 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyUp(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyUp(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyUp(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyUp(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyUp(); case ScalarInput.ISV_KEY_FN: return onFnKeyUp(); case ScalarInput.ISV_KEY_AEL: return onAelKeyUp(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyUp(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyUp(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyUp(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyUp(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyUp(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyUp(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyUp(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensDetached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return true; case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return true; case ScalarInput.ISV_KEY_MODE_DIAL: return true; default: return super.onKeyUp(keyCode, event); } }
Example 10
Source File: BaseActivity.java From BetterManual with MIT License | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyDown(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyDown(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyDown(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyDown(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyDown(); case ScalarInput.ISV_KEY_FN: return onFnKeyDown(); case ScalarInput.ISV_KEY_AEL: return onAelKeyDown(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyDown(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyDown(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyDown(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyDown(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyDown(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyDown(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyDown(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensAttached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return onUpperDialChanged(getDialStatus(ScalarInput.ISV_DIAL_1_STATUS) / 22); case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return onLowerDialChanged(getDialStatus(ScalarInput.ISV_DIAL_2_STATUS) / 22); case ScalarInput.ISV_KEY_MODE_DIAL: return onModeDialChanged(getDialStatus(ScalarInput.ISV_KEY_MODE_DIAL)); default: return super.onKeyDown(keyCode, event); } }
Example 11
Source File: BaseActivity.java From BetterManual with MIT License | 4 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyUp(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyUp(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyUp(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyUp(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyUp(); case ScalarInput.ISV_KEY_FN: return onFnKeyUp(); case ScalarInput.ISV_KEY_AEL: return onAelKeyUp(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyUp(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyUp(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyUp(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyUp(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyUp(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyUp(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyUp(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensDetached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return true; case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return true; case ScalarInput.ISV_KEY_MODE_DIAL: return true; default: return super.onKeyUp(keyCode, event); } }
Example 12
Source File: ManualActivity.java From BetterManual with MIT License | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { final int scanCode = event.getScanCode(); if (m_timelapseActive && scanCode != ScalarInput.ISV_KEY_ENTER) return true; // TODO: Use m_supportedPreviewMagnifications if (m_dialMode != DialMode.timelapseSetInterval && m_dialMode != DialMode.timelapseSetPicCount) { if (scanCode == 610 && !m_zoomLeverPressed) { // zoom lever tele m_zoomLeverPressed = true; if (m_curPreviewMagnification == 0) { m_curPreviewMagnification = 100; m_lFocusScale.setVisibility(View.GONE); } else m_curPreviewMagnification = 200; m_camera.setPreviewMagnification(m_curPreviewMagnification, m_curPreviewMagnificationPos); return true; } else if (scanCode == 611 && !m_zoomLeverPressed) { // zoom lever wide m_zoomLeverPressed = true; if (m_curPreviewMagnification == 200) { m_curPreviewMagnification = 100; m_camera.setPreviewMagnification(m_curPreviewMagnification, m_curPreviewMagnificationPos); } else { m_curPreviewMagnification = 0; m_camera.stopPreviewMagnification(); } return true; } else if (scanCode == 645) { // zoom lever returned to neutral position m_zoomLeverPressed = false; return true; } } return super.onKeyDown(keyCode, event); }
Example 13
Source File: BaseActivity.java From FocusBracket with MIT License | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyDown(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyDown(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyDown(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyDown(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyDown(); case ScalarInput.ISV_KEY_FN: return onFnKeyDown(); case ScalarInput.ISV_KEY_AEL: return onAelKeyDown(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyDown(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyDown(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyDown(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyDown(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyDown(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyDown(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyDown(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensAttached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return onUpperDialChanged(getDialStatus(ScalarInput.ISV_DIAL_1_STATUS) / 22); case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return onLowerDialChanged(getDialStatus(ScalarInput.ISV_DIAL_2_STATUS) / 22); case ScalarInput.ISV_KEY_MODE_DIAL: return onModeDialChanged(getDialStatus(ScalarInput.ISV_KEY_MODE_DIAL)); default: return super.onKeyDown(keyCode, event); } }
Example 14
Source File: BaseActivity.java From FocusBracket with MIT License | 4 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyUp(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyUp(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyUp(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyUp(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyUp(); case ScalarInput.ISV_KEY_FN: return onFnKeyUp(); case ScalarInput.ISV_KEY_AEL: return onAelKeyUp(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyUp(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyUp(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyUp(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyUp(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyUp(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyUp(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyUp(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensDetached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return true; case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return true; case ScalarInput.ISV_KEY_MODE_DIAL: return true; default: return super.onKeyUp(keyCode, event); } }
Example 15
Source File: BaseActivity.java From PMCADemo with MIT License | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyDown(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyDown(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyDown(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyDown(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyDown(); case ScalarInput.ISV_KEY_FN: return onFnKeyDown(); case ScalarInput.ISV_KEY_AEL: return onAelKeyDown(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyDown(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyDown(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyDown(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyDown(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyDown(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyDown(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyDown(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensAttached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return onUpperDialChanged(getDialStatus(ScalarInput.ISV_DIAL_1_STATUS) / 22); case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return onLowerDialChanged(getDialStatus(ScalarInput.ISV_DIAL_2_STATUS) / 22); case ScalarInput.ISV_KEY_MODE_DIAL: return onModeDialChanged(getDialStatus(ScalarInput.ISV_KEY_MODE_DIAL)); default: return super.onKeyDown(keyCode, event); } }
Example 16
Source File: BaseActivity.java From PMCADemo with MIT License | 4 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyUp(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyUp(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyUp(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyUp(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyUp(); case ScalarInput.ISV_KEY_FN: return onFnKeyUp(); case ScalarInput.ISV_KEY_AEL: return onAelKeyUp(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyUp(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyUp(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyUp(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyUp(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyUp(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyUp(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyUp(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensDetached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return true; case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return true; case ScalarInput.ISV_KEY_MODE_DIAL: return true; default: return super.onKeyUp(keyCode, event); } }
Example 17
Source File: BaseActivity.java From TimeLapse with MIT License | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { onAnyKeyDown(); switch (event.getScanCode()) { case ScalarInput.ISV_KEY_UP: return onUpKeyDown(); case ScalarInput.ISV_KEY_DOWN: return onDownKeyDown(); case ScalarInput.ISV_KEY_LEFT: return onLeftKeyDown(); case ScalarInput.ISV_KEY_RIGHT: return onRightKeyDown(); case ScalarInput.ISV_KEY_ENTER: return onEnterKeyDown(); case ScalarInput.ISV_KEY_FN: return onFnKeyDown(); case ScalarInput.ISV_KEY_AEL: return onAelKeyDown(); case ScalarInput.ISV_KEY_MENU: case ScalarInput.ISV_KEY_SK1: return onMenuKeyDown(); case ScalarInput.ISV_KEY_S1_1: return onFocusKeyDown(); case ScalarInput.ISV_KEY_S1_2: return true; case ScalarInput.ISV_KEY_S2: return onShutterKeyDown(); case ScalarInput.ISV_KEY_PLAY: return onPlayKeyDown(); case ScalarInput.ISV_KEY_STASTOP: return onMovieKeyDown(); case ScalarInput.ISV_KEY_CUSTOM1: return onC1KeyDown(); case ScalarInput.ISV_KEY_DELETE: case ScalarInput.ISV_KEY_SK2: return onDeleteKeyDown(); case ScalarInput.ISV_KEY_LENS_ATTACH: return onLensAttached(); case ScalarInput.ISV_DIAL_1_CLOCKWISE: case ScalarInput.ISV_DIAL_1_COUNTERCW: return onUpperDialChanged(getDialStatus(ScalarInput.ISV_DIAL_1_STATUS) / 22); case ScalarInput.ISV_DIAL_2_CLOCKWISE: case ScalarInput.ISV_DIAL_2_COUNTERCW: return onLowerDialChanged(getDialStatus(ScalarInput.ISV_DIAL_2_STATUS) / 22); case ScalarInput.ISV_DIAL_3_CLOCKWISE: case ScalarInput.ISV_DIAL_3_COUNTERCW: return onThirdDialChanged(getDialStatus(ScalarInput.ISV_DIAL_3_STATUS) / 22); case ScalarInput.ISV_DIAL_KURU_CLOCKWISE: case ScalarInput.ISV_DIAL_KURU_COUNTERCW: return onKuruDialChanged(getDialStatus(ScalarInput.ISV_DIAL_KURU_STATUS) / 22); case ScalarInput.ISV_KEY_MODE_DIAL: return onModeDialChanged(getDialStatus(ScalarInput.ISV_KEY_MODE_DIAL)); default: return super.onKeyDown(keyCode, event); } }