下面列出了android.view.KeyEvent#getScanCode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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);
}
@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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
@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);
}
}
@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);
}
}
@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);
}
}
@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);
}
}
@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);
}
}
@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);
}
}
@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);
}
@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);
}
}
@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);
}
}
@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);
}
}
@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);
}
}