Java Code Examples for android.support.v4.media.session.PlaybackStateCompat#ACTION_PLAY_FROM_SEARCH
The following examples show how to use
android.support.v4.media.session.PlaybackStateCompat#ACTION_PLAY_FROM_SEARCH .
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: PlaybackManager.java From Melophile with Apache License 2.0 | 6 votes |
private long getAvailableActions() { long actions = PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS | PlaybackStateCompat.ACTION_SKIP_TO_NEXT; if (playback.isPlaying()) { actions |= PlaybackStateCompat.ACTION_PAUSE; } else { actions |= PlaybackStateCompat.ACTION_PLAY; } // if (isRepeat) { actions |= PlaybackStateCompat.ACTION_SET_REPEAT_MODE; } // if (isShuffle) { actions |= PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE_ENABLED; } return actions; }
Example 2
Source File: MusicService.java From LyricHere with Apache License 2.0 | 6 votes |
private long getAvailableActions() { long actions = PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH; if (mPlayingQueue == null || mPlayingQueue.isEmpty()) { return actions; } if (mPlayback.isPlaying()) { actions |= PlaybackStateCompat.ACTION_PAUSE; } if (mCurrentIndexOnQueue > 0) { actions |= PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS; } if (mCurrentIndexOnQueue < mPlayingQueue.size() - 1) { actions |= PlaybackStateCompat.ACTION_SKIP_TO_NEXT; } return actions; }
Example 3
Source File: WebViewPhoneFragment.java From carstream-android-auto with Apache License 2.0 | 5 votes |
private long getAvailableActions() { long actions = PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS | PlaybackStateCompat.ACTION_SKIP_TO_NEXT; // if (true) { // actions |= PlaybackStateCompat.ACTION_PAUSE; // } else { // actions |= PlaybackStateCompat.ACTION_PLAY; // } return actions; }
Example 4
Source File: MyMediaBrowserService.java From carstream-android-auto with Apache License 2.0 | 5 votes |
private long getAvailableActions() { long actions = PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS | PlaybackStateCompat.ACTION_SKIP_TO_NEXT; return actions; }
Example 5
Source File: VideoFragment.java From leanback-homescreen-channels with Apache License 2.0 | 5 votes |
@PlaybackStateCompat.Actions private long getAvailableActions() { long actions = PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH; if (mMediaPlayerGlue.isPlaying()) { actions |= PlaybackStateCompat.ACTION_PAUSE; } else { actions |= PlaybackStateCompat.ACTION_PLAY; } return actions; }
Example 6
Source File: PlaybackManager.java From klingar with Apache License 2.0 | 5 votes |
private long getAvailableActions() { long actions = PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS | PlaybackStateCompat.ACTION_SKIP_TO_NEXT; if (playback.isPlaying()) { actions |= PlaybackStateCompat.ACTION_PAUSE; } else { actions |= PlaybackStateCompat.ACTION_PLAY; } return actions; }
Example 7
Source File: MediaPlayerAdapter.java From android-MediaBrowserService with Apache License 2.0 | 5 votes |
/** * Set the current capabilities available on this session. Note: If a capability is not * listed in the bitmask of capabilities then the MediaSession will not handle it. For * example, if you don't want ACTION_STOP to be handled by the MediaSession, then don't * included it in the bitmask that's returned. */ @PlaybackStateCompat.Actions private long getAvailableActions() { long actions = PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH | PlaybackStateCompat.ACTION_SKIP_TO_NEXT | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS; switch (mState) { case PlaybackStateCompat.STATE_STOPPED: actions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE; break; case PlaybackStateCompat.STATE_PLAYING: actions |= PlaybackStateCompat.ACTION_STOP | PlaybackStateCompat.ACTION_PAUSE | PlaybackStateCompat.ACTION_SEEK_TO; break; case PlaybackStateCompat.STATE_PAUSED: actions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_STOP; break; default: actions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_STOP | PlaybackStateCompat.ACTION_PAUSE; } return actions; }
Example 8
Source File: PlayerMediaPlayer.java From blade-player with GNU General Public License v3.0 | 4 votes |
public PlaybackStateCompat getPlaybackState() { long actions = PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH | PlaybackStateCompat.ACTION_SKIP_TO_NEXT | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS | PlaybackStateCompat.ACTION_SET_REPEAT_MODE | PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE; int playbackState = 0; switch(currentState) { case PLAYER_STATE_PAUSED: actions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_STOP | PlaybackStateCompat.ACTION_SEEK_TO; playbackState = PlaybackStateCompat.STATE_PAUSED; break; case PLAYER_STATE_PLAYING: actions |= PlaybackStateCompat.ACTION_PAUSE | PlaybackStateCompat.ACTION_STOP | PlaybackStateCompat.ACTION_SEEK_TO; playbackState = PlaybackStateCompat.STATE_PLAYING; break; case PLAYER_STATE_STOPPED: actions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE; playbackState = PlaybackStateCompat.STATE_STOPPED; break; case PLAYER_STATE_NONE: actions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE; playbackState = PlaybackStateCompat.STATE_STOPPED; break; case PLAYER_STATE_DO_NOTHING: actions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE; playbackState = PlaybackStateCompat.STATE_STOPPED; } final PlaybackStateCompat.Builder stateBuilder = new PlaybackStateCompat.Builder(); stateBuilder.setActions(actions); stateBuilder.setState(playbackState, getCurrentPosition(), 1.0f, SystemClock.elapsedRealtime()); return stateBuilder.build(); }