本文整理汇总了Java中android.support.v4.media.session.PlaybackStateCompat.State方法的典型用法代码示例。如果您正苦于以下问题:Java PlaybackStateCompat.State方法的具体用法?Java PlaybackStateCompat.State怎么用?Java PlaybackStateCompat.State使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.media.session.PlaybackStateCompat
的用法示例。
在下文中一共展示了PlaybackStateCompat.State方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePlaybackState
import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void updatePlaybackState(
@PlaybackStateCompat.State int state, long playbackActions, int position, int mediaId) {
PlaybackStateCompat.Builder builder =
new PlaybackStateCompat.Builder()
.setActions(playbackActions)
.setActiveQueueItemId(mediaId)
.setState(state, position, 1.0f);
mSession.setPlaybackState(builder.build());
}
示例2: assertMediaStateIs
import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void assertMediaStateIs(@PlaybackStateCompat.State int expectedState) {
PlaybackState state = rule.getActivity().getMediaController().getPlaybackState();
assertNotNull(state);
assertThat(
"MediaSession is not in the correct state",
state.getState(),
is(equalTo(expectedState)));
}
示例3: setNewState
import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void setNewState(@PlaybackStateCompat.State int newPlayerState) {
mState = newPlayerState;
// Whether playback goes to completion, or whether it is stopped, the
// mCurrentMediaPlayedToCompletion is set to true.
if (mState == PlaybackStateCompat.STATE_STOPPED) {
mCurrentMediaPlayedToCompletion = true;
}
// Work around for MediaPlayer.getCurrentPosition() when it changes while not playing.
final long reportPosition;
if (mSeekWhileNotPlaying >= 0) {
reportPosition = mSeekWhileNotPlaying;
if (mState == PlaybackStateCompat.STATE_PLAYING) {
mSeekWhileNotPlaying = -1;
}
} else {
reportPosition = mMediaPlayer == null ? 0 : mMediaPlayer.getCurrentPosition();
}
final PlaybackStateCompat.Builder stateBuilder = new PlaybackStateCompat.Builder();
stateBuilder.setActions(getAvailableActions());
stateBuilder.setState(mState,
reportPosition,
1.0f,
SystemClock.elapsedRealtime());
mPlaybackInfoListener.onPlaybackStateChange(stateBuilder.build());
}
示例4: updatePlaybackState
import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void updatePlaybackState(
@PlaybackStateCompat.State int state,
long position,
MediaDescriptionCompat description) {
PlaybackStateCompat.Builder builder =
new PlaybackStateCompat.Builder()
.setActions(AVAILABLE_MEDIA_ACTIONS)
.setActiveQueueItemId(Long.parseLong(description.getMediaId()))
.setState(state, position, 1.0f);
mSession.setPlaybackState(builder.build());
}
示例5: setNewState
import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void setNewState(@PlaybackStateCompat.State int newPlayerState) {
mState = newPlayerState;
// Whether playback goes to completion, or whether it is stopped, the
// mCurrentMediaPlayedToCompletion is set to true.
if (mState == PlaybackStateCompat.STATE_STOPPED) {
mCurrentMediaPlayedToCompletion = true;
}
// Work around for MediaPlayer.getCurrentPosition() when it changes while not playing.
final long reportPosition;
if (mSeekWhileNotPlaying >= 0) {
reportPosition = mSeekWhileNotPlaying;
if (mState == PlaybackStateCompat.STATE_PLAYING) {
mSeekWhileNotPlaying = -1;
}
} else {
reportPosition = mMediaPlayer == null ? 0 : mMediaPlayer.getCurrentPosition();
}
final PlaybackStateCompat.Builder stateBuilder = new PlaybackStateCompat.Builder();
stateBuilder.setActions(getAvailableActions());
stateBuilder.setState(mState,
reportPosition,
1.0f,
SystemClock.elapsedRealtime());
mPlaybackInfoListener.onPlaybackStateChange(stateBuilder.build());
}