Java Code Examples for android.view.KeyEvent#KEYCODE_P
The following examples show how to use
android.view.KeyEvent#KEYCODE_P .
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: MainActivity.java From Xndroid with GNU General Public License v3.0 | 6 votes |
@Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.isCtrlPressed()) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_P: // Open a new private window if(event.isShiftPressed()) { startActivity(new Intent(this, IncognitoActivity.class)); overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale); return true; } break; } } return super.dispatchKeyEvent(event); }
Example 2
Source File: MainActivity.java From JumpGo with Mozilla Public License 2.0 | 6 votes |
@Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.isCtrlPressed()) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_P: // Open a new private window if(event.isShiftPressed()) { startActivity(new Intent(this, IncognitoActivity.class)); overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale); return true; } break; } } return super.dispatchKeyEvent(event); }
Example 3
Source File: A2dpSinkActivity.java From sample-bluetooth-audio with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_P: // Enable Pairing mode (discoverable) enableDiscoverable(); return true; case KeyEvent.KEYCODE_D: // Disconnect any currently connected devices disconnectConnectedDevices(); return true; } return super.onKeyUp(keyCode, event); }
Example 4
Source File: A2dpSinkActivity.java From sample-bluetooth-audio with Apache License 2.0 | 5 votes |
private void configureButton() { try { mPairingButtonDriver = new ButtonInputDriver(BoardDefaults.getGPIOForPairing(), Button.LogicState.PRESSED_WHEN_LOW, KeyEvent.KEYCODE_P); mPairingButtonDriver.register(); mDisconnectAllButtonDriver = new ButtonInputDriver( BoardDefaults.getGPIOForDisconnectAllBTDevices(), Button.LogicState.PRESSED_WHEN_LOW, KeyEvent.KEYCODE_D); mDisconnectAllButtonDriver.register(); } catch (IOException e) { Log.w(TAG, "Could not register GPIO button drivers. Use keyboard events to trigger " + "the functions instead", e); } }
Example 5
Source File: SimpleFPSDisplay.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_F: mGLThread.toggleFPSDisplay(); return true; case KeyEvent.KEYCODE_P: mGLThread.setAnim(false); return true; } return super.onKeyDown(keyCode, event); }
Example 6
Source File: SimpleFPSDisplay.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_P: mGLThread.setAnim(true); return true; } return super.onKeyUp(keyCode, event); }
Example 7
Source File: TextureGL.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_F: mGLThread.toggleFPSDisplay(); return true; case KeyEvent.KEYCODE_P: mGLThread.setAnim(false); return true; } return super.onKeyDown(keyCode, event); }
Example 8
Source File: TextureGL.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_P: mGLThread.setAnim(true); return true; } return super.onKeyUp(keyCode, event); }
Example 9
Source File: AndroidOpenGL.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_P: queueEvent(new Runnable() { public void run() { mRenderer.togglePause(); } }); return true; } return super.onKeyDown(keyCode, event); }
Example 10
Source File: SimpleFPSDisplay.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_F: mGLThread.toggleFPSDisplay(); return true; case KeyEvent.KEYCODE_P: mGLThread.setAnim(false); return true; } return super.onKeyDown(keyCode, event); }
Example 11
Source File: SimpleFPSDisplay.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_P: mGLThread.setAnim(true); return true; } return super.onKeyUp(keyCode, event); }
Example 12
Source File: TextureGL.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_F: mGLThread.toggleFPSDisplay(); return true; case KeyEvent.KEYCODE_P: mGLThread.setAnim(false); return true; } return super.onKeyDown(keyCode, event); }
Example 13
Source File: TextureGL.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_P: mGLThread.setAnim(true); return true; } return super.onKeyUp(keyCode, event); }
Example 14
Source File: AndroidOpenGL.java From opengl with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_P: queueEvent(new Runnable() { public void run() { mRenderer.togglePause(); } }); return true; } return super.onKeyDown(keyCode, event); }
Example 15
Source File: ReadBookActivity.java From HaoReader with GNU General Public License v3.0 | 4 votes |
/** * 按键事件 */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawer(GravityCompat.START); return true; } else if (ReadAloudService.running && aloudStatus == PLAY) { ReadAloudService.pause(this); toast(getString(R.string.read_aloud_pause)); return true; } else { onBackPressed(); return true; } } else if (keyCode == KeyEvent.KEYCODE_MENU) { if (isMenuShowing()) { popMenuOut(); } else { popMenuIn(); } return true; } else if (!isMenuShowing()) { if (readBookControl.getCanKeyTurn(aloudStatus == ReadAloudService.PLAY) && keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { if (mPageLoader != null) { mPageLoader.skipToNextPage(); } return true; } else if (readBookControl.getCanKeyTurn(aloudStatus == ReadAloudService.PLAY) && keyCode == KeyEvent.KEYCODE_VOLUME_UP) { if (mPageLoader != null) { mPageLoader.skipToPrePage(); } return true; } else if (keyCode == KeyEvent.KEYCODE_N) { if (mPageLoader != null) { mPageLoader.skipToNextPage(); } return true; } else if (keyCode == KeyEvent.KEYCODE_P) { if (mPageLoader != null) { mPageLoader.skipToPrePage(); } return true; } else if (keyCode == KeyEvent.KEYCODE_SPACE) { if (mPageLoader != null) { mPageLoader.skipToNextPage(); } return true; } } return super.onKeyDown(keyCode, event); }