List of usage examples for android.view KeyEvent KEYCODE_MEDIA_STOP
int KEYCODE_MEDIA_STOP
To view the source code for android.view KeyEvent KEYCODE_MEDIA_STOP.
Click Source Link
From source file:com.aujur.ebookreader.activity.ReadingFragment.java
public boolean dispatchMediaKeyEvent(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); if (audioManager.isMusicActive() && !ttsIsRunning()) { return false; }//from ww w. j a v a2 s . c o m switch (keyCode) { case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_PAUSE: return simulateButtonPress(action, R.id.playPauseButton, playPauseButton); case KeyEvent.KEYCODE_MEDIA_STOP: return simulateButtonPress(action, R.id.stopButton, stopButton); case KeyEvent.KEYCODE_MEDIA_NEXT: return simulateButtonPress(action, R.id.nextButton, nextButton); case KeyEvent.KEYCODE_MEDIA_PREVIOUS: return simulateButtonPress(action, R.id.prevButton, prevButton); } return false; }
From source file:me.spadival.podmode.PodModeService.java
void processStopRequest() { if (mPodStatus == podStat.ADVANCEDHACK) { broadcastMediaButtons(KeyEvent.KEYCODE_MEDIA_STOP, mAdvancedRemoteApp); return;// w w w .ja v a 2s . c om } processStopRequest(false); }
From source file:me.spadival.podmode.PodModeService.java
@Override public void onDestroy() { // Service is being killed, so make sure we release our resources mState = State.Stopped;//from w w w.j ava 2 s . com mPodRunning = false; AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); if ((mPodStatus == podStat.SIMPLEREMOTE || mPodStatus == podStat.ADVANCEDHACK) && am.isMusicActive()) { broadcastMediaButtons(KeyEvent.KEYCODE_MEDIA_STOP, null); } // Stop the timer task if (mMediaChangeTimer != null) mMediaChangeTimer.cancel(); // Stop the main thread if (mMainThread != null) { Thread moribund = mMainThread; mMainThread = null; moribund.interrupt(); } // mProvider.dropRemoteControls(true); relaxResources(true); giveUpAudioFocus(); if (mSerialHost != null) mSerialHost.end(); if (mSerialDevice != null) mSerialDevice.DestroyAccessory(true); if (mBTDevice != null) mBTDevice.stop(); if (podWakeLock != null) podWakeLock.release(); unregisterReceiver(mUsbReceiver); LocalBroadcastManager.getInstance(this).unregisterReceiver(mNotifyReceiver); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); mRetriever.saveState(prefs, mNowPlaying); super.onDestroy(); }