本文整理汇总了Java中android.support.v4.media.session.PlaybackStateCompat.ACTION_STOP属性的典型用法代码示例。如果您正苦于以下问题:Java PlaybackStateCompat.ACTION_STOP属性的具体用法?Java PlaybackStateCompat.ACTION_STOP怎么用?Java PlaybackStateCompat.ACTION_STOP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v4.media.session.PlaybackStateCompat
的用法示例。
在下文中一共展示了PlaybackStateCompat.ACTION_STOP属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAvailableActions
/**
* 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;
}
示例2: getAvailableActions
/**
* 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;
}