CommandButton
public final class CommandButton
A button for a SessionCommand or Player.Command that can be displayed by controllers.
| See also | |
|---|---|
setCustomLayout |
|
onCustomLayoutChanged |
Summary
Nested types |
|---|
public final class CommandButton.BuilderA builder for |
@UnstableApiConstraints for displaying a list of |
public final class CommandButton.DisplayConstraints.BuilderA builder for |
@DocumentedAn icon constant for a button. |
@UnstableApiA slot at which a button can be displayed in a UI surface. |
Constants |
|
|---|---|
static final int |
ICON_ALBUM = 57369An icon showing an album symbol (a stylized LP record). |
static final int |
ICON_ARTIST = 57370An icon showing an artist symbol (a stylized person with a musical note). |
static final int |
ICON_BLOCK = 57675An icon showing a block symbol (a circle with a diagonal line). |
static final int |
ICON_BOOKMARK_FILLED = 1042534An icon showing a filled bookmark symbol. |
static final int |
ICON_BOOKMARK_UNFILLED = 59494An icon showing an unfilled bookmark symbol. |
static final int |
ICON_CHECK_CIRCLE_FILLED = 1042540An icon showing a filled circle with a check mark. |
static final int |
ICON_CHECK_CIRCLE_UNFILLED = 59500An icon showing a unfilled circle with a check mark. |
static final int |
ICON_CLOSED_CAPTIONS = 57372An icon showing a closed caption symbol (a rectangle with the letters CC). |
static final int |
ICON_CLOSED_CAPTIONS_OFF = 61916An icon showing a closed caption off symbol (a rectangle with the letters CC, with a large diagonal line across). |
static final int |
ICON_FAST_FORWARD = 57375An icon showing a fast forward symbol (two right facing triangles). |
static final int |
ICON_FEED = 57573An icon showing an feed symbol (a dot in the bottom-left with multiple concentric quarter circles). |
static final int |
ICON_FLAG_FILLED = 1040723An icon showing a filled flag symbol. |
static final int |
ICON_FLAG_UNFILLED = 57683An icon showing an unfilled flag symbol. |
static final int |
ICON_HEART_FILLED = 1042557An icon showing a filled heart symbol. |
static final int |
ICON_HEART_UNFILLED = 59517An icon showing an unfilled heart symbol. |
static final int |
ICON_MINUS = 57691An icon showing a minus symbol. |
static final int |
ICON_MINUS_CIRCLE_FILLED = 1040712An icon showing a filled circle with a minus. |
static final int |
ICON_MINUS_CIRCLE_UNFILLED = 1040713An icon showing an unfilled circle with a minus. |
static final int |
ICON_NEXT = 57412An icon showing a next symbol (a right facing triangle with a vertical bar). |
static final int |
ICON_PAUSE = 57396An icon showing a pause symbol (two vertical bars). |
static final int |
ICON_PLAY = 57399An icon showing a play symbol (a right facing triangle). |
static final int |
ICON_PLAYBACK_SPEED = 57448An icon showing a playback speed symbol (a right facing triangle in a circle with half-dashed, half-solid contour). |
static final int |
ICON_PLAYBACK_SPEED_0_5 = 62690An icon showing a 0.5x speed symbol. |
static final int |
ICON_PLAYBACK_SPEED_0_8 = 1045730An icon showing a 0.8x speed symbol. |
static final int |
ICON_PLAYBACK_SPEED_1_0 = 61389An icon showing a 1.0x speed symbol. |
static final int |
ICON_PLAYBACK_SPEED_1_2 = 62689An icon showing a 1.2x speed symbol. |
static final int |
ICON_PLAYBACK_SPEED_1_5 = 62688An icon showing a 1.5x speed symbol. |
static final int |
ICON_PLAYBACK_SPEED_1_8 = 1045728An icon showing a 1.8x speed symbol. |
static final int |
ICON_PLAYBACK_SPEED_2_0 = 62699An icon showing a 2.0x speed symbol. |
static final int |
ICON_PLAYLIST_ADD = 57403An icon showing an add to playlist symbol (multiple horizontal bars with a small plus). |
static final int |
ICON_PLAYLIST_REMOVE = 60288An icon showing an remove from playlist symbol (multiple horizontal bars with a small minus). |
static final int |
ICON_PLUS = 57669An icon showing a plus symbol. |
static final int |
ICON_PLUS_CIRCLE_FILLED = 1040711An icon showing a filled circle with a plus. |
static final int |
ICON_PLUS_CIRCLE_UNFILLED = 57671An icon showing an unfilled circle with a plus. |
static final int |
ICON_PREVIOUS = 57413An icon showing a previous symbol (a left facing triangle with a vertical bar). |
static final int |
ICON_QUALITY = 58409An icon showing a quality selection symbol (multiple horizontal bars with sliders). |
static final int |
ICON_QUEUE_ADD = 57436An icon showing an add to queue symbol (a stylized TV with a plus). |
static final int |
ICON_QUEUE_NEXT = 57446An icon showing a play next queue item symbol (a stylized TV with a plus and a right-facing arrow). |
static final int |
ICON_QUEUE_REMOVE = 57447An icon showing a remove from queue symbol (a stylized TV with a minus). |
static final int |
ICON_RADIO = 58654An icon showing a radio symbol (left and right facing sound waves). |
static final int |
ICON_REPEAT_ALL = 57408An icon showing a repeat all symbol (two open clockwise arrows). |
static final int |
ICON_REPEAT_OFF = 1040448An icon showing a disabled repeat symbol (two open clockwise arrows, in a color representing a disabled state). |
static final int |
ICON_REPEAT_ONE = 57409An icon showing a repeat one symbol (two open clockwise arrows with an overlaid number 1). |
static final int |
ICON_REWIND = 57376An icon showing a rewind symbol (two left facing triangles). |
static final int |
ICON_SETTINGS = 59576An icon showing a settings symbol (a stylized cog). |
static final int |
ICON_SHARE = 59405An icon showing a share symbol (three dots connected by two diagonal lines, open on the right). |
static final int |
ICON_SHUFFLE_OFF = 1040452An icon showing a disabled shuffle symbol (two diagonal upward and downward facing arrows, in a color representing a disabled state). |
static final int |
ICON_SHUFFLE_ON = 57411An icon showing a shuffle symbol (two diagonal upward and downward facing arrows). |
static final int |
ICON_SHUFFLE_STAR = 1040451An icon showing a shuffle symbol with a start (two diagonal upward and downward facing arrows with an overlaid star). |
static final int |
ICON_SIGNAL = 61512An icon showing an signal symbol (a vertical mast with circular sounds waves). |
static final int |
ICON_SKIP_BACK = 57410An icon showing a skip back symbol (an open anti-clockwise arrow). |
static final int |
ICON_SKIP_BACK_10 = 57433An icon showing a skip back 10 seconds symbol (an open anti-clockwise arrow with the number 10). |
static final int |
ICON_SKIP_BACK_15 = 1040473An icon showing a skip back 15 seconds symbol (an open anti-clockwise arrow with the number 15). |
static final int |
ICON_SKIP_BACK_30 = 57434An icon showing a skip back 30 seconds symbol (an open anti-clockwise arrow with the number 30). |
static final int |
ICON_SKIP_BACK_5 = 57435An icon showing a skip back 5 seconds symbol (an open anti-clockwise arrow with the number 5). |
static final int |
ICON_SKIP_FORWARD = 63220An icon showing a skip forward symbol (an open clock-wise arrow). |
static final int |
ICON_SKIP_FORWARD_10 = 57430An icon showing a skip forward 10 seconds symbol (an open clockwise arrow with the number 10). |
static final int |
ICON_SKIP_FORWARD_15 = 1040470An icon showing a skip forward 15 seconds symbol (an open clockwise arrow with the number 15). |
static final int |
ICON_SKIP_FORWARD_30 = 57431An icon showing a skip forward 30 seconds symbol (an open clockwise arrow with the number 30). |
static final int |
ICON_SKIP_FORWARD_5 = 57432An icon showing a skip forward 5 seconds symbol (an open clockwise arrow with the number 5). |
static final int |
ICON_STAR_FILLED = 1042488An icon showing a filled star symbol. |
static final int |
ICON_STAR_UNFILLED = 59448An icon showing an unfilled star symbol. |
static final int |
ICON_STOP = 57415An icon showing a stop symbol (a square). |
static final int |
ICON_SUBTITLES = 57416An icon showing a subtitles symbol (a rectangle filled with dots and horizontal lines). |
static final int |
ICON_SUBTITLES_OFF = 61298An icon showing a subtitles off symbol (a rectangle filled with dots and horizontal lines, with a large diagonal line across). |
static final int |
ICON_SYNC = 58919An icon showing a sync symbol (two open anti-clockwise arrows). |
static final int |
ICON_THUMB_DOWN_FILLED = 1042651An icon showing a filled thumb-down symbol. |
static final int |
ICON_THUMB_DOWN_UNFILLED = 59611An icon showing an unfilled thumb-down symbol. |
static final int |
ICON_THUMB_UP_FILLED = 1042652An icon showing a filled thumb-up symbol. |
static final int |
ICON_THUMB_UP_UNFILLED = 59612An icon showing an unfilled thumb-up symbol. |
static final int |
ICON_UNDEFINED = 0An icon constant representing an undefined icon, for example a custom icon not covered by the existing constants. |
static final int |
ICON_VOLUME_DOWN = 57421An icon showing a volume down symbol (a stylized speaker with a single small sound wave). |
static final int |
ICON_VOLUME_OFF = 57423An icon showing a volume off symbol (a stylized speaker with multiple sound waves, with a large diagonal line across). |
static final int |
ICON_VOLUME_UP = 57424An icon showing a volume up symbol (a stylized speaker with multiple sound waves). |
static final int |
@UnstableApiA slot in a playback control UI for backward-directed playback actions, most commonly used for previous or rewind actions. |
static final int |
A slot in a playback control UI for secondary backward-directed playback actions, most commonly used for previous or rewind actions. |
static final int |
A central slot in a playback control UI, most commonly used for play or pause actions. |
static final int |
A slot in a playback control UI for forward-directed playback actions, most commonly used for next or fast-forward actions. |
static final int |
A slot in a playback control UI for secondary forward-directed playback actions, most commonly used for next or fast-forward actions. |
static final int |
A slot in a playback control UI for additional actions that don't fit into other slots. |
Public fields |
|
|---|---|
final CharSequence |
The display name of the button. |
final Bundle |
The extra |
final int |
The |
final @DrawableRes int |
The fallback icon resource ID of the button. |
final @Nullable Uri |
The fallback |
final boolean |
Whether the button is enabled. |
final @Nullable Object |
The optional parameter needed to execute the action associated with this button via |
final int |
The |
final @Nullable SessionCommand |
The session command of the button. |
final ImmutableIntArray |
The allowed |
Public methods |
|
|---|---|
boolean |
Returns whether the command button has a configuration that allows to execute the associated action via a |
boolean |
Checks the given command button for equality while ignoring |
void |
@UnstableApiExecutes the intended action of the command button by calling the appropriate |
static CommandButton |
@UnstableApiThis method is deprecated. Use |
static CommandButton |
@UnstableApiRestores a |
static int |
@UnstableApiReturns the default |
static @DrawableRes int |
Returns a drawable resource id for the given |
int |
hashCode() |
Bundle |
Constants
ICON_ALBUM
public static final int ICON_ALBUM = 57369
An icon showing an album symbol (a stylized LP record).
ICON_ARTIST
public static final int ICON_ARTIST = 57370
An icon showing an artist symbol (a stylized person with a musical note).
ICON_BLOCK
public static final int ICON_BLOCK = 57675
An icon showing a block symbol (a circle with a diagonal line).
ICON_BOOKMARK_FILLED
public static final int ICON_BOOKMARK_FILLED = 1042534
An icon showing a filled bookmark symbol.
ICON_BOOKMARK_UNFILLED
public static final int ICON_BOOKMARK_UNFILLED = 59494
An icon showing an unfilled bookmark symbol.
ICON_CHECK_CIRCLE_FILLED
public static final int ICON_CHECK_CIRCLE_FILLED = 1042540
An icon showing a filled circle with a check mark.
ICON_CHECK_CIRCLE_UNFILLED
public static final int ICON_CHECK_CIRCLE_UNFILLED = 59500
An icon showing a unfilled circle with a check mark.
ICON_CLOSED_CAPTIONS
public static final int ICON_CLOSED_CAPTIONS = 57372
An icon showing a closed caption symbol (a rectangle with the letters CC).
ICON_CLOSED_CAPTIONS_OFF
public static final int ICON_CLOSED_CAPTIONS_OFF = 61916
An icon showing a closed caption off symbol (a rectangle with the letters CC, with a large diagonal line across).
ICON_FAST_FORWARD
public static final int ICON_FAST_FORWARD = 57375
An icon showing a fast forward symbol (two right facing triangles).
ICON_FEED
public static final int ICON_FEED = 57573
An icon showing an feed symbol (a dot in the bottom-left with multiple concentric quarter circles).
ICON_FLAG_FILLED
public static final int ICON_FLAG_FILLED = 1040723
An icon showing a filled flag symbol.
ICON_FLAG_UNFILLED
public static final int ICON_FLAG_UNFILLED = 57683
An icon showing an unfilled flag symbol.
ICON_HEART_FILLED
public static final int ICON_HEART_FILLED = 1042557
An icon showing a filled heart symbol.
ICON_HEART_UNFILLED
public static final int ICON_HEART_UNFILLED = 59517
An icon showing an unfilled heart symbol.
ICON_MINUS_CIRCLE_FILLED
public static final int ICON_MINUS_CIRCLE_FILLED = 1040712
An icon showing a filled circle with a minus.
ICON_MINUS_CIRCLE_UNFILLED
public static final int ICON_MINUS_CIRCLE_UNFILLED = 1040713
An icon showing an unfilled circle with a minus.
ICON_NEXT
public static final int ICON_NEXT = 57412
An icon showing a next symbol (a right facing triangle with a vertical bar).
ICON_PAUSE
public static final int ICON_PAUSE = 57396
An icon showing a pause symbol (two vertical bars).
ICON_PLAY
public static final int ICON_PLAY = 57399
An icon showing a play symbol (a right facing triangle).
ICON_PLAYBACK_SPEED
public static final int ICON_PLAYBACK_SPEED = 57448
An icon showing a playback speed symbol (a right facing triangle in a circle with half-dashed, half-solid contour).
ICON_PLAYBACK_SPEED_0_5
public static final int ICON_PLAYBACK_SPEED_0_5 = 62690
An icon showing a 0.5x speed symbol.
ICON_PLAYBACK_SPEED_0_8
public static final int ICON_PLAYBACK_SPEED_0_8 = 1045730
An icon showing a 0.8x speed symbol.
ICON_PLAYBACK_SPEED_1_0
public static final int ICON_PLAYBACK_SPEED_1_0 = 61389
An icon showing a 1.0x speed symbol.
ICON_PLAYBACK_SPEED_1_2
public static final int ICON_PLAYBACK_SPEED_1_2 = 62689
An icon showing a 1.2x speed symbol.
ICON_PLAYBACK_SPEED_1_5
public static final int ICON_PLAYBACK_SPEED_1_5 = 62688
An icon showing a 1.5x speed symbol.
ICON_PLAYBACK_SPEED_1_8
public static final int ICON_PLAYBACK_SPEED_1_8 = 1045728
An icon showing a 1.8x speed symbol.
ICON_PLAYBACK_SPEED_2_0
public static final int ICON_PLAYBACK_SPEED_2_0 = 62699
An icon showing a 2.0x speed symbol.
ICON_PLAYLIST_ADD
public static final int ICON_PLAYLIST_ADD = 57403
An icon showing an add to playlist symbol (multiple horizontal bars with a small plus).
ICON_PLAYLIST_REMOVE
public static final int ICON_PLAYLIST_REMOVE = 60288
An icon showing an remove from playlist symbol (multiple horizontal bars with a small minus).
ICON_PLUS_CIRCLE_FILLED
public static final int ICON_PLUS_CIRCLE_FILLED = 1040711
An icon showing a filled circle with a plus.
ICON_PLUS_CIRCLE_UNFILLED
public static final int ICON_PLUS_CIRCLE_UNFILLED = 57671
An icon showing an unfilled circle with a plus.
ICON_PREVIOUS
public static final int ICON_PREVIOUS = 57413
An icon showing a previous symbol (a left facing triangle with a vertical bar).
ICON_QUALITY
public static final int ICON_QUALITY = 58409
An icon showing a quality selection symbol (multiple horizontal bars with sliders).
ICON_QUEUE_ADD
public static final int ICON_QUEUE_ADD = 57436
An icon showing an add to queue symbol (a stylized TV with a plus).
ICON_QUEUE_NEXT
public static final int ICON_QUEUE_NEXT = 57446
An icon showing a play next queue item symbol (a stylized TV with a plus and a right-facing arrow).
ICON_QUEUE_REMOVE
public static final int ICON_QUEUE_REMOVE = 57447
An icon showing a remove from queue symbol (a stylized TV with a minus).
ICON_RADIO
public static final int ICON_RADIO = 58654
An icon showing a radio symbol (left and right facing sound waves).
ICON_REPEAT_ALL
public static final int ICON_REPEAT_ALL = 57408
An icon showing a repeat all symbol (two open clockwise arrows).
ICON_REPEAT_OFF
public static final int ICON_REPEAT_OFF = 1040448
An icon showing a disabled repeat symbol (two open clockwise arrows, in a color representing a disabled state).
ICON_REPEAT_ONE
public static final int ICON_REPEAT_ONE = 57409
An icon showing a repeat one symbol (two open clockwise arrows with an overlaid number 1).
ICON_REWIND
public static final int ICON_REWIND = 57376
An icon showing a rewind symbol (two left facing triangles).
ICON_SETTINGS
public static final int ICON_SETTINGS = 59576
An icon showing a settings symbol (a stylized cog).
ICON_SHARE
public static final int ICON_SHARE = 59405
An icon showing a share symbol (three dots connected by two diagonal lines, open on the right).
ICON_SHUFFLE_OFF
public static final int ICON_SHUFFLE_OFF = 1040452
An icon showing a disabled shuffle symbol (two diagonal upward and downward facing arrows, in a color representing a disabled state).
ICON_SHUFFLE_ON
public static final int ICON_SHUFFLE_ON = 57411
An icon showing a shuffle symbol (two diagonal upward and downward facing arrows).
ICON_SHUFFLE_STAR
public static final int ICON_SHUFFLE_STAR = 1040451
An icon showing a shuffle symbol with a start (two diagonal upward and downward facing arrows with an overlaid star).
ICON_SIGNAL
public static final int ICON_SIGNAL = 61512
An icon showing an signal symbol (a vertical mast with circular sounds waves).
ICON_SKIP_BACK
public static final int ICON_SKIP_BACK = 57410
An icon showing a skip back symbol (an open anti-clockwise arrow).
ICON_SKIP_BACK_10
public static final int ICON_SKIP_BACK_10 = 57433
An icon showing a skip back 10 seconds symbol (an open anti-clockwise arrow with the number 10).
ICON_SKIP_BACK_15
public static final int ICON_SKIP_BACK_15 = 1040473
An icon showing a skip back 15 seconds symbol (an open anti-clockwise arrow with the number 15).
ICON_SKIP_BACK_30
public static final int ICON_SKIP_BACK_30 = 57434
An icon showing a skip back 30 seconds symbol (an open anti-clockwise arrow with the number 30).
ICON_SKIP_BACK_5
public static final int ICON_SKIP_BACK_5 = 57435
An icon showing a skip back 5 seconds symbol (an open anti-clockwise arrow with the number 5).
ICON_SKIP_FORWARD
public static final int ICON_SKIP_FORWARD = 63220
An icon showing a skip forward symbol (an open clock-wise arrow).
ICON_SKIP_FORWARD_10
public static final int ICON_SKIP_FORWARD_10 = 57430
An icon showing a skip forward 10 seconds symbol (an open clockwise arrow with the number 10).
ICON_SKIP_FORWARD_15
public static final int ICON_SKIP_FORWARD_15 = 1040470
An icon showing a skip forward 15 seconds symbol (an open clockwise arrow with the number 15).
ICON_SKIP_FORWARD_30
public static final int ICON_SKIP_FORWARD_30 = 57431
An icon showing a skip forward 30 seconds symbol (an open clockwise arrow with the number 30).
ICON_SKIP_FORWARD_5
public static final int ICON_SKIP_FORWARD_5 = 57432
An icon showing a skip forward 5 seconds symbol (an open clockwise arrow with the number 5).
ICON_STAR_FILLED
public static final int ICON_STAR_FILLED = 1042488
An icon showing a filled star symbol.
ICON_STAR_UNFILLED
public static final int ICON_STAR_UNFILLED = 59448
An icon showing an unfilled star symbol.
ICON_SUBTITLES
public static final int ICON_SUBTITLES = 57416
An icon showing a subtitles symbol (a rectangle filled with dots and horizontal lines).
ICON_SUBTITLES_OFF
public static final int ICON_SUBTITLES_OFF = 61298
An icon showing a subtitles off symbol (a rectangle filled with dots and horizontal lines, with a large diagonal line across).
ICON_SYNC
public static final int ICON_SYNC = 58919
An icon showing a sync symbol (two open anti-clockwise arrows).
ICON_THUMB_DOWN_FILLED
public static final int ICON_THUMB_DOWN_FILLED = 1042651
An icon showing a filled thumb-down symbol.
ICON_THUMB_DOWN_UNFILLED
public static final int ICON_THUMB_DOWN_UNFILLED = 59611
An icon showing an unfilled thumb-down symbol.
ICON_THUMB_UP_FILLED
public static final int ICON_THUMB_UP_FILLED = 1042652
An icon showing a filled thumb-up symbol.
ICON_THUMB_UP_UNFILLED
public static final int ICON_THUMB_UP_UNFILLED = 59612
An icon showing an unfilled thumb-up symbol.
ICON_UNDEFINED
public static final int ICON_UNDEFINED = 0
An icon constant representing an undefined icon, for example a custom icon not covered by the existing constants.
ICON_VOLUME_DOWN
public static final int ICON_VOLUME_DOWN = 57421
An icon showing a volume down symbol (a stylized speaker with a single small sound wave).
ICON_VOLUME_OFF
public static final int ICON_VOLUME_OFF = 57423
An icon showing a volume off symbol (a stylized speaker with multiple sound waves, with a large diagonal line across).
ICON_VOLUME_UP
public static final int ICON_VOLUME_UP = 57424
An icon showing a volume up symbol (a stylized speaker with multiple sound waves).
SLOT_BACK
@UnstableApi
public static final int SLOT_BACK = 2
A slot in a playback control UI for backward-directed playback actions, most commonly used for previous or rewind actions.
SLOT_BACK_SECONDARY
@UnstableApi
public static final int SLOT_BACK_SECONDARY = 4
A slot in a playback control UI for secondary backward-directed playback actions, most commonly used for previous or rewind actions.
SLOT_CENTRAL
@UnstableApi
public static final int SLOT_CENTRAL = 1
A central slot in a playback control UI, most commonly used for play or pause actions.
SLOT_FORWARD
@UnstableApi
public static final int SLOT_FORWARD = 3
A slot in a playback control UI for forward-directed playback actions, most commonly used for next or fast-forward actions.
SLOT_FORWARD_SECONDARY
@UnstableApi
public static final int SLOT_FORWARD_SECONDARY = 5
A slot in a playback control UI for secondary forward-directed playback actions, most commonly used for next or fast-forward actions.
SLOT_OVERFLOW
@UnstableApi
public static final int SLOT_OVERFLOW = 6
A slot in a playback control UI for additional actions that don't fit into other slots.
Public fields
displayName
public final CharSequence displayName
The display name of the button. Can be empty if the command is predefined and a custom name isn't needed.
extras
public final Bundle extras
The extra Bundle of the button. It's private information between session and controller.
iconResId
public final @DrawableRes int iconResId
The fallback icon resource ID of the button.
This is used when either the predefined icon is not available, or it's set to ICON_UNDEFINED.
Can be 0 if not needed.
iconUri
public final @Nullable Uri iconUri
The fallback content or resourceUri for the icon of the button.
This is used when either the predefined icon is not available, or it's set to ICON_UNDEFINED.
Can be null.
Note that this value can be used in addition to iconResId for consumers that are capable of loading the content or resource Uri.
isEnabled
public final boolean isEnabled
Whether the button is enabled.
Note that this value will be set to false for MediaController instances if the corresponding command is not available to this controller (see playerCommand and sessionCommand).
parameter
@UnstableApi
public final @Nullable Object parameter
The optional parameter needed to execute the action associated with this button via executeAction.
playerCommand
@Player.Command
public final int playerCommand
The Player.Command command of the button. Will be COMMAND_INVALID if sessionCommand is set.
sessionCommand
public final @Nullable SessionCommand sessionCommand
The session command of the button. Will be null if playerCommand is set.
slots
@UnstableApi
public final ImmutableIntArray slots
The allowed Slot positions for this button.
The button is only allowed in the defined slots. If none of the slots can display the button, either because the slots do not exist, are already occupied or the UI surface does not allow the specific type of button in these slots, the button will not be displayed at all.
When multiple slots are provided, they define a preference order. The button will be placed in the first slot in the list that exists, isn't already occupied and that allows this type of button.
Public methods
canExecuteAction
@UnstableApi
public boolean canExecuteAction()
Returns whether the command button has a configuration that allows to execute the associated action via a MediaController. See executeAction for a list of valid configurations.
| Returns | |
|---|---|
boolean |
Whether |
equals
public boolean equals(@Nullable Object obj)
Checks the given command button for equality while ignoring extras.
executeAction
@UnstableApi
public void executeAction(MediaController controller)
Executes the intended action of the command button by calling the appropriate MediaController method.
The following player and session commands are supported. Whether the command button has a configuration that can be executed can also be checked with canExecuteAction.
If playerCommand is set, the following commands are supported:
COMMAND_PLAY_PAUSE: CallssetPlayWhenReadywith!controller.getPlayWhenReady(), or withparameterif provided viasetPlayerCommand.COMMAND_PREPARE: Callsprepare.COMMAND_STOP: Callsstop.COMMAND_SEEK_TO_PREVIOUS: CallsseekToPrevious.COMMAND_SEEK_TO_NEXT: CallsseekToNext.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM: CallsseekToPreviousMediaItem.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM: CallsseekToNextMediaItem.COMMAND_SEEK_BACK: CallsseekBack.COMMAND_SEEK_FORWARD: CallsseekForward.COMMAND_SEEK_TO_DEFAULT_POSITION: CallsseekToDefaultPosition.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM: CallsseekTowithparameterif provided viasetPlayerCommand.COMMAND_SEEK_TO_MEDIA_ITEM: CallsseekToDefaultPositionwithparameterif provided viasetPlayerCommand.COMMAND_SET_SPEED_AND_PITCH: CallssetPlaybackSpeedwithparameterif provided viasetPlayerCommand.COMMAND_SET_SHUFFLE_MODE: CallssetShuffleModeEnabledwith!controller.getShuffleModeEnabled(), or withparameterif provided viasetPlayerCommand.COMMAND_SET_REPEAT_MODE: CallssetRepeatModewithparameterif provided viasetPlayerCommand.COMMAND_SET_MEDIA_ITEM: CallssetMediaItemwithparameterif provided viasetPlayerCommand.COMMAND_SET_PLAYLIST_METADATA: CallssetPlaylistMetadatawithparameterif provided viasetPlayerCommand.COMMAND_SET_VOLUME: CallssetVolumewithparameterif provided viasetPlayerCommand, or callsmute/unmuteotherwise.COMMAND_SET_TRACK_SELECTION_PARAMETERS: CallssetTrackSelectionParameterswithparameterif provided viasetPlayerCommand.
If sessionCommand is set, the following commands are supported:
- If
sessionCommand.commandCodeisCOMMAND_CODE_CUSTOM, callssendCustomCommandwithsessionCommandandextras. - If
sessionCommand.commandCodeisCOMMAND_CODE_SESSION_SET_RATING, callssetRatingwithparameterif it is provided viasetSessionCommand.
Will do nothing if isEnabled is false.
fromBundle
@UnstableApi
public static CommandButton fromBundle(Bundle bundle, int sessionInterfaceVersion)
Restores a CommandButton from a Bundle.
getDefaultSlot
@UnstableApi
@CommandButton.Slot
public static int getDefaultSlot(
@Player.Command int playerCommand,
@CommandButton.Icon int icon
)
Returns the default Slot for a button.
| Parameters | |
|---|---|
@Player.Command int playerCommand |
The |
@CommandButton.Icon int icon |
The |
| Returns | |
|---|---|
int |
The default |
getIconResIdForIconConstant
@UnstableApi
public static @DrawableRes int getIconResIdForIconConstant(@CommandButton.Icon int icon)
Returns a drawable resource id for the given Icon constant.
| Parameters | |
|---|---|
@CommandButton.Icon int icon |
The |
| Returns | |
|---|---|
@DrawableRes int |
The drawable resource if for the |