public final class CommandButton implements Bundleable


A button for a SessionCommand or Player.Command that can be displayed by controllers.

Summary

Nested types

public final class CommandButton.Builder

A builder for CommandButton.

@UnstableApi
@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation CommandButton.Icon

An icon constant for a button.

Constants

static final Bundleable.Creator<CommandButton>

This field is deprecated.

Use fromBundle instead.

static final int

An icon showing an album symbol (a stylized LP record).

static final int

An icon showing an artist symbol (a stylized person with a musical note).

static final int

An icon showing a block symbol (a circle with a diagonal line).

static final int

An icon showing a filled bookmark symbol.

static final int

An icon showing an unfilled bookmark symbol.

static final int

An icon showing a filled circle with a check mark.

static final int

An icon showing a unfilled circle with a check mark.

static final int

An icon showing a closed caption symbol (a rectangle with the letters CC).

static final int

An icon showing a closed caption off symbol (a rectangle with the letters CC, with a large diagonal line across).

static final int

An icon showing a fast forward symbol (two right facing triangles).

static final int

An icon showing an feed symbol (a dot in the bottom-left with multiple concentric quarter circles).

static final int

An icon showing a filled flag symbol.

static final int

An icon showing an unfilled flag symbol.

static final int

An icon showing a filled heart symbol.

static final int

An icon showing an unfilled heart symbol.

static final int

An icon showing a minus symbol.

static final int

An icon showing a filled circle with a minus.

static final int

An icon showing an unfilled circle with a minus.

static final int

An icon showing a next symbol (a right facing triangle with a vertical bar).

static final int

An icon showing a pause symbol (two vertical bars).

static final int

An icon showing a play symbol (a right facing triangle).

static final int

An icon showing a playback speed symbol (a right facing triangle in a circle with half-dashed, half-solid contour).

static final int

An icon showing a 0.5x speed symbol.

static final int

An icon showing a 0.8x speed symbol.

static final int

An icon showing a 1.0x speed symbol.

static final int

An icon showing a 1.2x speed symbol.

static final int

An icon showing a 1.5x speed symbol.

static final int

An icon showing a 1.8x speed symbol.

static final int

An icon showing a 2.0x speed symbol.

static final int

An icon showing an add to playlist symbol (multiple horizontal bars with a small plus).

static final int

An icon showing an remove from playlist symbol (multiple horizontal bars with a small minus).

static final int

An icon showing a plus symbol.

static final int

An icon showing a filled circle with a plus.

static final int

An icon showing an unfilled circle with a plus.

static final int

An icon showing a previous symbol (a left facing triangle with a vertical bar).

static final int

An icon showing a quality selection symbol (multiple horizontal bars with sliders).

static final int

An icon showing an add to queue symbol (a stylized TV with a plus).

static final int

An icon showing a play next queue item symbol (a stylized TV with a plus and a right-facing arrow).

static final int

An icon showing a remove from queue symbol (a stylized TV with a minus).

static final int

An icon showing a radio symbol (left and right facing sound waves).

static final int

An icon showing a repeat all symbol (two open clockwise arrows).

static final int

An icon showing a disabled repeat symbol (two open clockwise arrows, in a color representing a disabled state).

static final int

An icon showing a repeat one symbol (two open clockwise arrows with an overlaid number 1).

static final int

An icon showing a rewind symbol (two left facing triangles).

static final int

An icon showing a settings symbol (a stylized cog).

static final int

An icon showing a share symbol (three dots connected by two diagonal lines, open on the right).

static final int

An icon showing a disabled shuffle symbol (two diagonal upward and downward facing arrows, in a color representing a disabled state).

static final int

An icon showing a shuffle symbol (two diagonal upward and downward facing arrows).

static final int

An icon showing a shuffle symbol with a start (two diagonal upward and downward facing arrows with an overlaid star).

static final int

An icon showing an signal symbol (a vertical mast with circular sounds waves).

static final int

An icon showing a skip back symbol (an open anti-clockwise arrow).

static final int

An icon showing a skip back 10 seconds symbol (an open anti-clockwise arrow with the number 10).

static final int

An icon showing a skip back 15 seconds symbol (an open anti-clockwise arrow with the number 15).

static final int

An icon showing a skip back 30 seconds symbol (an open anti-clockwise arrow with the number 30).

static final int

An icon showing a skip back 5 seconds symbol (an open anti-clockwise arrow with the number 5).

static final int

An icon showing a skip forward symbol (an open clock-wise arrow).

static final int

An icon showing a skip forward 10 seconds symbol (an open clockwise arrow with the number 10).

static final int

An icon showing a skip forward 15 seconds symbol (an open clockwise arrow with the number 15).

static final int

An icon showing a skip forward 30 seconds symbol (an open clockwise arrow with the number 30).

static final int

An icon showing a skip forward 5 seconds symbol (an open clockwise arrow with the number 5).

static final int

An icon showing a filled star symbol.

static final int

An icon showing an unfilled star symbol.

static final int

An icon showing a stop symbol (a square).

static final int

An icon showing a subtitles symbol (a rectangle filled with dots and horizontal lines).

static final int

An icon showing a subtitles off symbol (a rectangle filled with dots and horizontal lines, with a large diagonal line across).

static final int

An icon showing a sync symbol (two open anti-clockwise arrows).

static final int

An icon showing a filled thumb-down symbol.

static final int

An icon showing an unfilled thumb-down symbol.

static final int

An icon showing a filled thumb-up symbol.

static final int

An icon showing an unfilled thumb-up symbol.

static final int

An icon constant representing an undefined icon, for example a custom icon not covered by the existing constants.

static final int

An icon showing a volume down symbol (a stylized speaker with a single small sound wave).

static final int

An icon showing a volume off symbol (a stylized speaker with multiple sound waves, with a large diagonal line across).

static final int

An icon showing a volume up symbol (a stylized speaker with multiple sound waves).

Public fields

final CharSequence

The display name of the button.

final Bundle

The extra Bundle of the button.

final int

The Icon of the button.

final @DrawableRes int

The icon resource id of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED.

final @Nullable Uri

The Uri for the icon of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED.

final boolean

Whether the button is enabled.

final int

The Player.Command command of the button.

final @Nullable SessionCommand

The session command of the button.

Public methods

boolean

Checks the given command button for equality while ignoring extras.

static CommandButton

This method is deprecated.

Use fromBundle instead.

static CommandButton
@UnstableApi
fromBundle(Bundle bundle, int sessionInterfaceVersion)

Restores a CommandButton from a Bundle.

int
Bundle

Returns a Bundle representing the information stored in this object.

Constants

CREATOR

@UnstableApi
public static final Bundleable.Creator<CommandButtonCREATOR

Object that can restore CommandButton from a Bundle.

ICON_ALBUM

@UnstableApi
public static final int ICON_ALBUM = 57369

An icon showing an album symbol (a stylized LP record).

ICON_ARTIST

@UnstableApi
public static final int ICON_ARTIST = 57370

An icon showing an artist symbol (a stylized person with a musical note).

ICON_BLOCK

@UnstableApi
public static final int ICON_BLOCK = 57675

An icon showing a block symbol (a circle with a diagonal line).

ICON_BOOKMARK_FILLED

@UnstableApi
public static final int ICON_BOOKMARK_FILLED = 1042534

An icon showing a filled bookmark symbol.

ICON_BOOKMARK_UNFILLED

@UnstableApi
public static final int ICON_BOOKMARK_UNFILLED = 59494

An icon showing an unfilled bookmark symbol.

ICON_CHECK_CIRCLE_FILLED

@UnstableApi
public static final int ICON_CHECK_CIRCLE_FILLED = 1042540

An icon showing a filled circle with a check mark.

ICON_CHECK_CIRCLE_UNFILLED

@UnstableApi
public static final int ICON_CHECK_CIRCLE_UNFILLED = 59500

An icon showing a unfilled circle with a check mark.

ICON_CLOSED_CAPTIONS

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_FAST_FORWARD = 57375

An icon showing a fast forward symbol (two right facing triangles).

ICON_FEED

@UnstableApi
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

@UnstableApi
public static final int ICON_FLAG_FILLED = 1040723

An icon showing a filled flag symbol.

ICON_FLAG_UNFILLED

@UnstableApi
public static final int ICON_FLAG_UNFILLED = 57683

An icon showing an unfilled flag symbol.

ICON_HEART_FILLED

@UnstableApi
public static final int ICON_HEART_FILLED = 1042557

An icon showing a filled heart symbol.

ICON_HEART_UNFILLED

@UnstableApi
public static final int ICON_HEART_UNFILLED = 59517

An icon showing an unfilled heart symbol.

ICON_MINUS

@UnstableApi
public static final int ICON_MINUS = 57691

An icon showing a minus symbol.

ICON_MINUS_CIRCLE_FILLED

@UnstableApi
public static final int ICON_MINUS_CIRCLE_FILLED = 1040712

An icon showing a filled circle with a minus.

ICON_MINUS_CIRCLE_UNFILLED

@UnstableApi
public static final int ICON_MINUS_CIRCLE_UNFILLED = 1040713

An icon showing an unfilled circle with a minus.

ICON_NEXT

@UnstableApi
public static final int ICON_NEXT = 57412

An icon showing a next symbol (a right facing triangle with a vertical bar).

ICON_PAUSE

@UnstableApi
public static final int ICON_PAUSE = 57396

An icon showing a pause symbol (two vertical bars).

ICON_PLAY

@UnstableApi
public static final int ICON_PLAY = 57399

An icon showing a play symbol (a right facing triangle).

ICON_PLAYBACK_SPEED

@UnstableApi
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

@UnstableApi
public static final int ICON_PLAYBACK_SPEED_0_5 = 62690

An icon showing a 0.5x speed symbol.

ICON_PLAYBACK_SPEED_0_8

@UnstableApi
public static final int ICON_PLAYBACK_SPEED_0_8 = 1045730

An icon showing a 0.8x speed symbol.

ICON_PLAYBACK_SPEED_1_0

@UnstableApi
public static final int ICON_PLAYBACK_SPEED_1_0 = 61389

An icon showing a 1.0x speed symbol.

ICON_PLAYBACK_SPEED_1_2

@UnstableApi
public static final int ICON_PLAYBACK_SPEED_1_2 = 62689

An icon showing a 1.2x speed symbol.

ICON_PLAYBACK_SPEED_1_5

@UnstableApi
public static final int ICON_PLAYBACK_SPEED_1_5 = 62688

An icon showing a 1.5x speed symbol.

ICON_PLAYBACK_SPEED_1_8

@UnstableApi
public static final int ICON_PLAYBACK_SPEED_1_8 = 1045728

An icon showing a 1.8x speed symbol.

ICON_PLAYBACK_SPEED_2_0

@UnstableApi
public static final int ICON_PLAYBACK_SPEED_2_0 = 62699

An icon showing a 2.0x speed symbol.

ICON_PLAYLIST_ADD

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_PLUS = 57669

An icon showing a plus symbol.

ICON_PLUS_CIRCLE_FILLED

@UnstableApi
public static final int ICON_PLUS_CIRCLE_FILLED = 1040711

An icon showing a filled circle with a plus.

ICON_PLUS_CIRCLE_UNFILLED

@UnstableApi
public static final int ICON_PLUS_CIRCLE_UNFILLED = 57671

An icon showing an unfilled circle with a plus.

ICON_PREVIOUS

@UnstableApi
public static final int ICON_PREVIOUS = 57413

An icon showing a previous symbol (a left facing triangle with a vertical bar).

ICON_QUALITY

@UnstableApi
public static final int ICON_QUALITY = 58409

An icon showing a quality selection symbol (multiple horizontal bars with sliders).

ICON_QUEUE_ADD

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_QUEUE_REMOVE = 57447

An icon showing a remove from queue symbol (a stylized TV with a minus).

ICON_RADIO

@UnstableApi
public static final int ICON_RADIO = 58654

An icon showing a radio symbol (left and right facing sound waves).

ICON_REPEAT_ALL

@UnstableApi
public static final int ICON_REPEAT_ALL = 57408

An icon showing a repeat all symbol (two open clockwise arrows).

ICON_REPEAT_OFF

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_REWIND = 57376

An icon showing a rewind symbol (two left facing triangles).

ICON_SETTINGS

@UnstableApi
public static final int ICON_SETTINGS = 59576

An icon showing a settings symbol (a stylized cog).

ICON_SHARE

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_SHUFFLE_ON = 57411

An icon showing a shuffle symbol (two diagonal upward and downward facing arrows).

ICON_SHUFFLE_STAR

@UnstableApi
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

@UnstableApi
public static final int ICON_SIGNAL = 61512

An icon showing an signal symbol (a vertical mast with circular sounds waves).

ICON_SKIP_BACK

@UnstableApi
public static final int ICON_SKIP_BACK = 57410

An icon showing a skip back symbol (an open anti-clockwise arrow).

ICON_SKIP_BACK_10

@UnstableApi
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

@UnstableApi
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

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_SKIP_FORWARD = 63220

An icon showing a skip forward symbol (an open clock-wise arrow).

ICON_SKIP_FORWARD_10

@UnstableApi
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

@UnstableApi
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

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_STAR_FILLED = 1042488

An icon showing a filled star symbol.

ICON_STAR_UNFILLED

@UnstableApi
public static final int ICON_STAR_UNFILLED = 59448

An icon showing an unfilled star symbol.

ICON_STOP

@UnstableApi
public static final int ICON_STOP = 57415

An icon showing a stop symbol (a square).

ICON_SUBTITLES

@UnstableApi
public static final int ICON_SUBTITLES = 57416

An icon showing a subtitles symbol (a rectangle filled with dots and horizontal lines).

ICON_SUBTITLES_OFF

@UnstableApi
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

@UnstableApi
public static final int ICON_SYNC = 58919

An icon showing a sync symbol (two open anti-clockwise arrows).

ICON_THUMB_DOWN_FILLED

@UnstableApi
public static final int ICON_THUMB_DOWN_FILLED = 1042651

An icon showing a filled thumb-down symbol.

ICON_THUMB_DOWN_UNFILLED

@UnstableApi
public static final int ICON_THUMB_DOWN_UNFILLED = 59611

An icon showing an unfilled thumb-down symbol.

ICON_THUMB_UP_FILLED

@UnstableApi
public static final int ICON_THUMB_UP_FILLED = 1042652

An icon showing a filled thumb-up symbol.

ICON_THUMB_UP_UNFILLED

@UnstableApi
public static final int ICON_THUMB_UP_UNFILLED = 59612

An icon showing an unfilled thumb-up symbol.

ICON_UNDEFINED

@UnstableApi
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

@UnstableApi
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

@UnstableApi
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

@UnstableApi
public static final int ICON_VOLUME_UP = 57424

An icon showing a volume up symbol (a stylized speaker with multiple sound waves).

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

@UnstableApi
public final Bundle extras

The extra Bundle of the button. It's private information between session and controller.

icon

@UnstableApi
@CommandButton.Icon
public final int icon

The Icon of the button.

iconResId

public final @DrawableRes int iconResId

The icon resource id of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED. Can be 0 if not needed.

iconUri

@UnstableApi
public final @Nullable Uri iconUri

The Uri for the icon of the button that is used when the predefined icon is not available or set to ICON_UNDEFINED. Can be null.

Note that this value can be used in addition or instead of iconResId for consumers that are capable of loading the 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).

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.

Public methods

equals

public boolean equals(@Nullable Object obj)

Checks the given command button for equality while ignoring extras.

fromBundle

@UnstableApi
public static CommandButton fromBundle(Bundle bundle)

fromBundle

@UnstableApi
public static CommandButton fromBundle(Bundle bundle, int sessionInterfaceVersion)

Restores a CommandButton from a Bundle.

hashCode

public int hashCode()

toBundle

@UnstableApi
public Bundle toBundle()

Returns a Bundle representing the information stored in this object.