Java Code Examples for android.view.KeyEvent#KEYCODE_MEDIA_AUDIO_TRACK
The following examples show how to use
android.view.KeyEvent#KEYCODE_MEDIA_AUDIO_TRACK .
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: Utils.java From Noyze with Apache License 2.0 | 6 votes |
/** * @return True if a {@link android.view.KeyEvent} corresponds to a media action. */ public static boolean isMediaKeyCode(final int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_CLOSE: case KeyEvent.KEYCODE_MEDIA_EJECT: case KeyEvent.KEYCODE_MEDIA_NEXT: case KeyEvent.KEYCODE_MEDIA_PREVIOUS: case KeyEvent.KEYCODE_MEDIA_STOP: case KeyEvent.KEYCODE_MEDIA_RECORD: case KeyEvent.KEYCODE_MEDIA_REWIND: case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: return true; } return false; }
Example 2
Source File: Utils.java From Noyze with Apache License 2.0 | 6 votes |
/** * @return True if a {@link android.view.KeyEvent} corresponds to a media action. */ public static boolean isMediaKeyCode(final int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_CLOSE: case KeyEvent.KEYCODE_MEDIA_EJECT: case KeyEvent.KEYCODE_MEDIA_NEXT: case KeyEvent.KEYCODE_MEDIA_PREVIOUS: case KeyEvent.KEYCODE_MEDIA_STOP: case KeyEvent.KEYCODE_MEDIA_RECORD: case KeyEvent.KEYCODE_MEDIA_REWIND: case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: return true; } return false; }
Example 3
Source File: TabWebContentsDelegateAndroid.java From delion with Apache License 2.0 | 5 votes |
/** * Redispatches unhandled media keys. This allows bluetooth headphones with play/pause or * other buttons to function correctly. */ @TargetApi(19) private void handleMediaKey(KeyEvent e) { if (Build.VERSION.SDK_INT < 19) return; switch (e.getKeyCode()) { case KeyEvent.KEYCODE_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_STOP: case KeyEvent.KEYCODE_MEDIA_NEXT: case KeyEvent.KEYCODE_MEDIA_PREVIOUS: case KeyEvent.KEYCODE_MEDIA_REWIND: case KeyEvent.KEYCODE_MEDIA_RECORD: case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: case KeyEvent.KEYCODE_MEDIA_CLOSE: case KeyEvent.KEYCODE_MEDIA_EJECT: case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: AudioManager am = (AudioManager) mTab.getApplicationContext().getSystemService( Context.AUDIO_SERVICE); am.dispatchMediaKeyEvent(e); break; default: break; } }
Example 4
Source File: TabWebContentsDelegateAndroid.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Redispatches unhandled media keys. This allows bluetooth headphones with play/pause or * other buttons to function correctly. */ @TargetApi(19) private void handleMediaKey(KeyEvent e) { if (Build.VERSION.SDK_INT < 19) return; switch (e.getKeyCode()) { case KeyEvent.KEYCODE_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_STOP: case KeyEvent.KEYCODE_MEDIA_NEXT: case KeyEvent.KEYCODE_MEDIA_PREVIOUS: case KeyEvent.KEYCODE_MEDIA_REWIND: case KeyEvent.KEYCODE_MEDIA_RECORD: case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: case KeyEvent.KEYCODE_MEDIA_CLOSE: case KeyEvent.KEYCODE_MEDIA_EJECT: case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: AudioManager am = (AudioManager) mTab.getApplicationContext().getSystemService( Context.AUDIO_SERVICE); am.dispatchMediaKeyEvent(e); break; default: break; } }
Example 5
Source File: TabWebContentsDelegateAndroid.java From 365browser with Apache License 2.0 | 5 votes |
/** * Redispatches unhandled media keys. This allows bluetooth headphones with play/pause or * other buttons to function correctly. */ @TargetApi(19) private void handleMediaKey(KeyEvent e) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return; switch (e.getKeyCode()) { case KeyEvent.KEYCODE_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_STOP: case KeyEvent.KEYCODE_MEDIA_NEXT: case KeyEvent.KEYCODE_MEDIA_PREVIOUS: case KeyEvent.KEYCODE_MEDIA_REWIND: case KeyEvent.KEYCODE_MEDIA_RECORD: case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: case KeyEvent.KEYCODE_MEDIA_CLOSE: case KeyEvent.KEYCODE_MEDIA_EJECT: case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: AudioManager am = (AudioManager) mTab.getApplicationContext().getSystemService( Context.AUDIO_SERVICE); am.dispatchMediaKeyEvent(e); break; default: break; } }
Example 6
Source File: VideoPlayerActivity.java From VCL-Android with Apache License 2.0 | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_BUTTON_B) return super.onKeyDown(keyCode, event); if (mIsLoading) { switch (keyCode) { case KeyEvent.KEYCODE_S: case KeyEvent.KEYCODE_MEDIA_STOP: exitOK(); return true; } return false; } showOverlayTimeout(OVERLAY_TIMEOUT); switch (keyCode) { case KeyEvent.KEYCODE_F: case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: case KeyEvent.KEYCODE_MEDIA_NEXT: seekDelta(10000); return true; case KeyEvent.KEYCODE_R: case KeyEvent.KEYCODE_MEDIA_REWIND: case KeyEvent.KEYCODE_MEDIA_PREVIOUS: seekDelta(-10000); return true; case KeyEvent.KEYCODE_BUTTON_R1: seekDelta(60000); return true; case KeyEvent.KEYCODE_BUTTON_L1: seekDelta(-60000); return true; case KeyEvent.KEYCODE_BUTTON_A: if (mOverlayProgress.getVisibility() == View.VISIBLE) return false; case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_SPACE: if (mIsNavMenu) return navigateDvdMenu(keyCode); else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) //prevent conflict with remote control return super.onKeyDown(keyCode, event); else doPlayPause(); return true; case KeyEvent.KEYCODE_O: case KeyEvent.KEYCODE_BUTTON_Y: case KeyEvent.KEYCODE_MENU: showAdvancedOptions(mAdvOptions); return true; case KeyEvent.KEYCODE_V: case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: case KeyEvent.KEYCODE_BUTTON_X: onAudioSubClick(mTracks); return true; case KeyEvent.KEYCODE_N: showNavMenu(); return true; case KeyEvent.KEYCODE_A: resizeVideo(); return true; case KeyEvent.KEYCODE_M: case KeyEvent.KEYCODE_VOLUME_MUTE: updateMute(); return true; case KeyEvent.KEYCODE_S: case KeyEvent.KEYCODE_MEDIA_STOP: exitOK(); return true; case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: if (mIsNavMenu) return navigateDvdMenu(keyCode); else return super.onKeyDown(keyCode, event); case KeyEvent.KEYCODE_J: delayAudio(-50000l); return true; case KeyEvent.KEYCODE_K: delayAudio(50000l); return true; case KeyEvent.KEYCODE_G: delaySubs(-50000l); return true; case KeyEvent.KEYCODE_H: delaySubs(50000l); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: if (mMute) { updateMute(); return true; } else return false; } return super.onKeyDown(keyCode, event); }