List of usage examples for android.view KeyEvent KEYCODE_VOLUME_MUTE
int KEYCODE_VOLUME_MUTE
To view the source code for android.view KeyEvent KEYCODE_VOLUME_MUTE.
Click Source Link
From source file:com.lybeat.lilyplayer.widget.media.IjkVideoView.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_VOLUME_MUTE && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL; if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) { if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) { if (mMediaPlayer.isPlaying()) { pause();//from w w w.j av a 2 s . co m mMediaController.show(); } else { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) { if (!mMediaPlayer.isPlaying()) { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) { if (mMediaPlayer.isPlaying()) { pause(); mMediaController.show(); } return true; } else { toggleMediaControlsVisibility(); } } return super.onKeyDown(keyCode, event); }
From source file:com.xnxs.mediaplayer.widget.media.VRVideoView.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_VOLUME_MUTE && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL; if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) { if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) { if (mMediaPlayer.isPlaying()) { pause();/*from w w w . ja v a2 s .c om*/ mMediaController.show(); } else { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) { if (!mMediaPlayer.isPlaying()) { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) { if (mMediaPlayer.isPlaying()) { pause(); mMediaController.show(); } return true; } else { toggleMediaControlsVisiblity(); } } return super.onKeyDown(keyCode, event); }
From source file:com.rfo.basic.Run.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // The user hit a key // Log.v(LOGTAG, "onKeyDown" + keyCode); // Eat the MENU key Down event, will handle the Up event. if (keyCode == KeyEvent.KEYCODE_MENU) return true; // If event is null, we called this directly from runLoop(), // so the return value does not matter. if (event == null) return true; // Alternate: if the user program has set mBlockVolKeys, block everything but BACK // if (mBlockVolKeys && (keyCode != KeyEvent.KEYCODE_BACK)) return true; // If the user program has set mBlockVolKeys, block volume and headset keys. if (mBlockVolKeys && ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) || (keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) || (keyCode == KeyEvent.KEYCODE_MUTE) || (keyCode == KeyEvent.KEYCODE_HEADSETHOOK))) { return true; }/*w w w . j a va 2 s. c om*/ // Otherwise pass the KeyEvent up the chain. return super.onKeyDown(keyCode, event); }