public boolean onKeyDown(int KeyCode, KeyEvent event) { super.onKeyDown(KeyCode, event); if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (KeyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: x -= 15; invalidate(); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: x += 15; invalidate(); return true; case KeyEvent.KEYCODE_DPAD_UP: y -= 15; invalidate(); return true; case KeyEvent.KEYCODE_DPAD_DOWN: y += 15; invalidate(); return true; } } return false; }
// @Override public boolean onKeyDown(int keyCode, KeyEvent event) { super.onKeyDown(keyCode, event); switch (keyCode) { case 0xCF: case 0xCE: case 0xCD: case 0xCC: case 0xCB: case 0xCA: case 0xC9: case 0xC8: case 0xC7: case 0xC6: case 0xC5: case 0xC4: case 0xC3: case 0xC2: case 0xC1: KeyOp(KeyEvent.KEYCODE_DPAD_LEFT); break; case 0xFF: case 0xFE: case 0xFD: case 0xFC: case 0xFB: case 0xFA: case 0xF9: case 0xF8: case 0xF7: case 0xF6: case 0xF5: case 0xF4: case 0xF3: case 0xF2: case 0xF1: KeyOp(KeyEvent.KEYCODE_DPAD_RIGHT); break; case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: break; case 115: if (!MenuItemName.equals("shortcut_common_vol_")) break; case KeyEvent.KEYCODE_DPAD_LEFT: KeyOp(KeyEvent.KEYCODE_DPAD_LEFT); break; case 114: if (!MenuItemName.equals("shortcut_common_vol_")) break; case KeyEvent.KEYCODE_DPAD_RIGHT: KeyOp(KeyEvent.KEYCODE_DPAD_RIGHT); break; case KeyEvent.KEYCODE_BACK: onKeyDown(KeyEvent.KEYCODE_ENTER, event); return true; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: if (ProgressListener != null) ProgressListener.ProgressBarToMenuHandle(progress, false, MenuItemName); break; case KeyEvent.KEYCODE_MENU: if (ProgressListener != null) ProgressListener.ProgressBarToMenuHandle(progress, false, "__Nothing__"); break; } return super.onKeyDown(keyCode, event); }