List of usage examples for android.view KeyEvent KEYCODE_BUTTON_L1
int KEYCODE_BUTTON_L1
To view the source code for android.view KeyEvent KEYCODE_BUTTON_L1.
Click Source Link
From source file:com.aengbee.android.leanback.ui.PlaybackOverlayActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BUTTON_R1) { getMediaController().getTransportControls().skipToNext(); return true; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L1) { getMediaController().getTransportControls().skipToPrevious(); return true; } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L2) { getMediaController().getTransportControls().rewind(); } else if (keyCode == KeyEvent.KEYCODE_BUTTON_R2) { getMediaController().getTransportControls().fastForward(); }/* ww w . j a v a 2 s . c o m*/ return super.onKeyDown(keyCode, event); }
From source file:org.mozilla.gecko.BrowserApp.java
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (AndroidGamepadManager.handleKeyEvent(event)) { return true; }/*from w w w . j a v a2 s .c o m*/ // Global onKey handler. This is called if the focused UI doesn't // handle the key event, and before Gecko swallows the events. if (event.getAction() != KeyEvent.ACTION_DOWN) { return false; } if ((event.getSource() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) { switch (keyCode) { case KeyEvent.KEYCODE_BUTTON_Y: // Toggle/focus the address bar on gamepad-y button. if (mBrowserChrome.getVisibility() == View.VISIBLE) { if (mDynamicToolbar.isEnabled() && !isHomePagerVisible()) { mDynamicToolbar.setVisible(false, VisibilityTransition.ANIMATE); if (mLayerView != null) { mLayerView.requestFocus(); } } else { // Just focus the address bar when about:home is visible // or when the dynamic toolbar isn't enabled. mBrowserToolbar.requestFocusFromTouch(); } } else { mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE); mBrowserToolbar.requestFocusFromTouch(); } return true; case KeyEvent.KEYCODE_BUTTON_L1: // Go back on L1 Tabs.getInstance().getSelectedTab().doBack(); return true; case KeyEvent.KEYCODE_BUTTON_R1: // Go forward on R1 Tabs.getInstance().getSelectedTab().doForward(); return true; } } // Check if this was a shortcut. Meta keys exists only on 11+. final Tab tab = Tabs.getInstance().getSelectedTab(); if (Versions.feature11Plus && tab != null && event.isCtrlPressed()) { switch (keyCode) { case KeyEvent.KEYCODE_LEFT_BRACKET: tab.doBack(); return true; case KeyEvent.KEYCODE_RIGHT_BRACKET: tab.doForward(); return true; case KeyEvent.KEYCODE_R: tab.doReload(); return true; case KeyEvent.KEYCODE_PERIOD: tab.doStop(); return true; case KeyEvent.KEYCODE_T: addTab(); return true; case KeyEvent.KEYCODE_W: Tabs.getInstance().closeTab(tab); return true; case KeyEvent.KEYCODE_F: mFindInPageBar.show(); return true; } } return false; }