Java Code Examples for android.view.KeyEvent#KEYCODE_BUTTON_L2
The following examples show how to use
android.view.KeyEvent#KEYCODE_BUTTON_L2 .
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: PlaybackActivity.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BUTTON_R1) { mPlaybackFragment.skipToNext(); return true; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L1) { mPlaybackFragment.skipToPrevious(); return true; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L2) { mPlaybackFragment.rewind(); } else if (keyCode == KeyEvent.KEYCODE_BUTTON_R2) { mPlaybackFragment.fastForward(); } return super.onKeyDown(keyCode, event); }
Example 2
Source File: AliteIntro.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override public boolean dispatchKeyEvent(KeyEvent event) { if (isController(event.getSource())) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_BUTTON_A: case KeyEvent.KEYCODE_BUTTON_B: case KeyEvent.KEYCODE_BUTTON_X: case KeyEvent.KEYCODE_BUTTON_Y: case KeyEvent.KEYCODE_BUTTON_L1: case KeyEvent.KEYCODE_BUTTON_L2: if (getCurrentFocus() instanceof VideoView) { VideoView videoView = (VideoView) getCurrentFocus(); if (videoView != null) { try { videoView.stopPlayback(); } catch (IllegalStateException e) { // Ignore... } } startAlite(videoView); } break; } } return super.dispatchKeyEvent(event); }
Example 3
Source File: PlaybackActivity.java From androidtv-Leanback with Apache License 2.0 | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BUTTON_R1) { mPlaybackFragment.skipToNext(); return true; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L1) { mPlaybackFragment.skipToPrevious(); return true; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L2) { mPlaybackFragment.rewind(); } else if (keyCode == KeyEvent.KEYCODE_BUTTON_R2) { mPlaybackFragment.fastForward(); } return super.onKeyDown(keyCode, event); }
Example 4
Source File: GamepadController.java From AndroidDemoProjects with Apache License 2.0 | 6 votes |
/** * Updates the tracked state values of this controller in response to a key input event. */ public void handleKeyEvent(KeyEvent keyEvent) { boolean keyIsDown = keyEvent.getAction() == KeyEvent.ACTION_DOWN; if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_A) { mButtonState[BUTTON_A][FRAME_INDEX_CURRENT] = keyIsDown; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_B) { mButtonState[BUTTON_B][FRAME_INDEX_CURRENT] = keyIsDown; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_X) { mButtonState[BUTTON_X][FRAME_INDEX_CURRENT] = keyIsDown; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_Y) { mButtonState[BUTTON_Y][FRAME_INDEX_CURRENT] = keyIsDown; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_R1 ) { mButtonState[BUTTON_R1][FRAME_INDEX_CURRENT] = keyIsDown; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_R2 ) { mButtonState[BUTTON_R2][FRAME_INDEX_CURRENT] = keyIsDown; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_L1 ) { mButtonState[BUTTON_L1][FRAME_INDEX_CURRENT] = keyIsDown; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BUTTON_L2 ) { mButtonState[BUTTON_L2][FRAME_INDEX_CURRENT] = keyIsDown; } }
Example 5
Source File: AndroidControllerMapping.java From gdx-controllerutils with Apache License 2.0 | 5 votes |
AndroidControllerMapping() { super(0, 1, 2, 3, KeyEvent.KEYCODE_BUTTON_A, KeyEvent.KEYCODE_BUTTON_B, KeyEvent.KEYCODE_BUTTON_X, KeyEvent.KEYCODE_BUTTON_Y, KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_BUTTON_L1, KeyEvent.KEYCODE_BUTTON_L2, KeyEvent.KEYCODE_BUTTON_R1, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.KEYCODE_BUTTON_THUMBL, KeyEvent.KEYCODE_BUTTON_THUMBR); }
Example 6
Source File: GamePadActivity.java From bombsquad-remote-android with Apache License 2.0 | 5 votes |
boolean _isRunKey(int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_BUTTON_R1: case KeyEvent.KEYCODE_BUTTON_R2: case KeyEvent.KEYCODE_BUTTON_L1: case KeyEvent.KEYCODE_BUTTON_L2: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: return true; default: return false; } }
Example 7
Source File: GamepadMappings.java From 365browser with Apache License 2.0 | 5 votes |
private static void mapLowerTriggerButtonsToBottomShoulder(float[] mappedButtons, float[] rawButtons) { float l2 = rawButtons[KeyEvent.KEYCODE_BUTTON_L2]; float r2 = rawButtons[KeyEvent.KEYCODE_BUTTON_R2]; mappedButtons[CanonicalButtonIndex.LEFT_TRIGGER] = l2; mappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER] = r2; }
Example 8
Source File: AndroidJoystickJoyInput14.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
protected JoystickButton addButton( int keyCode ) { // logger.log(Level.FINE, "Adding button: {0}", keyCode); String name = KeyEvent.keyCodeToString(keyCode); String original = KeyEvent.keyCodeToString(keyCode); // A/B/X/Y buttons if (keyCode == KeyEvent.KEYCODE_BUTTON_Y) { original = JoystickButton.BUTTON_0; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_B) { original = JoystickButton.BUTTON_1; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_A) { original = JoystickButton.BUTTON_2; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_X) { original = JoystickButton.BUTTON_3; // Front buttons Some of these have the top ones and the bottoms ones flipped. } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L1) { original = JoystickButton.BUTTON_4; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_R1) { original = JoystickButton.BUTTON_5; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L2) { original = JoystickButton.BUTTON_6; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_R2) { original = JoystickButton.BUTTON_7; // // Dpad buttons // } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { // original = JoystickButton.BUTTON_8; // } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { // original = JoystickButton.BUTTON_9; // } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { // original = JoystickButton.BUTTON_8; // } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { // original = JoystickButton.BUTTON_9; // Select and start buttons } else if (keyCode == KeyEvent.KEYCODE_BUTTON_SELECT) { original = JoystickButton.BUTTON_8; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_START) { original = JoystickButton.BUTTON_9; // Joystick push buttons } else if (keyCode == KeyEvent.KEYCODE_BUTTON_THUMBL) { original = JoystickButton.BUTTON_10; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_THUMBR) { original = JoystickButton.BUTTON_11; } String logicalId = JoystickCompatibilityMappings.remapComponent( getName(), original ); if( logicalId == null ? original != null : !logicalId.equals(original) ) { logger.log(Level.FINE, "Remapped: {0} to: {1}", new Object[]{original, logicalId}); } JoystickButton button = new DefaultJoystickButton( getInputManager(), this, getButtonCount(), name, logicalId ); addButton(button); buttonIndex.put( keyCode, button ); return button; }