Action

public class Action

Known direct subclasses
GuidedAction

A data class which represents an action within a .

PlaybackControlsRow.MoreActions

An action displaying an icon for "more actions".

PlaybackControlsRow.MultiAction

Base class for an action comprised of a series of icons.

PlaybackControlsRow.PictureInPictureAction

An action displaying an icon for picture-in-picture.

PlaybackControlsRow.SkipNextAction

An action displaying an icon for skip next.

PlaybackControlsRow.SkipPreviousAction

An action displaying an icon for skip previous.

Known indirect subclasses
GuidedDatePickerAction

Subclass of GuidedAction that can choose a date.

PlaybackControlsRow.ClosedCaptioningAction

An action for displaying a CC (Closed Captioning) icon.

PlaybackControlsRow.FastForwardAction

An action displaying an icon for fast forward.

PlaybackControlsRow.HighQualityAction

An action for displaying a HQ (High Quality) icon.

PlaybackControlsRow.PlayPauseAction

An action displaying icons for play and pause.

PlaybackControlsRow.RepeatAction

An action for displaying three repeat states: none, one, or all.

PlaybackControlsRow.RewindAction

An action displaying an icon for rewind.

PlaybackControlsRow.ShuffleAction

An action for displaying a shuffle icon.

PlaybackControlsRow.ThumbsAction

A base class for displaying a thumbs action.

PlaybackControlsRow.ThumbsDownAction

An action displaying an icon for thumbs down.

PlaybackControlsRow.ThumbsUpAction

An action displaying an icon for thumbs up.


An action contains one or two lines of text, an optional image and an optional id. It may also be invoked by one or more keycodes.

Summary

Constants

static final long
NO_ID = -1

Indicates that an id has not been set.

Public constructors

Action(long id)

Constructor for an Action.

Action(long id, @Nullable CharSequence label)

Constructor for an Action.

Action(
    long id,
    @Nullable CharSequence label1,
    @Nullable CharSequence label2
)

Constructor for an Action.

Action(
    long id,
    @Nullable CharSequence label1,
    @Nullable CharSequence label2,
    @Nullable Drawable icon
)

Constructor for an Action.

Public methods

final void
addKeyCode(int keyCode)

Adds a keycode used to invoke this Action.

final @Nullable Drawable

Returns the icon drawable for this Action.

final long

Returns the id for this Action.

final @Nullable CharSequence

Returns the first line label for this Action.

final @Nullable CharSequence

Returns the second line label for this Action.

final void
removeKeyCode(int keyCode)

Removes a keycode used to invoke this Action.

final boolean
respondsToKeyCode(int keyCode)

Returns true if the Action should respond to the given keycode.

final void

Sets the icon drawable for this Action.

final void
setId(long id)

Sets the id for this Action.

final void

Sets the first line label for this Action.

final void

Sets the second line label for this Action.

@NonNull String

Constants

NO_ID

Added in 1.1.0
public static final long NO_ID = -1

Indicates that an id has not been set.

Public constructors

Action

Added in 1.1.0
public Action(long id)

Constructor for an Action.

Parameters
long id

The id of the Action.

Action

Added in 1.1.0
public Action(long id, @Nullable CharSequence label)

Constructor for an Action.

Parameters
long id

The id of the Action.

@Nullable CharSequence label

The label to display for the Action.

Action

Added in 1.1.0
public Action(
    long id,
    @Nullable CharSequence label1,
    @Nullable CharSequence label2
)

Constructor for an Action.

Parameters
long id

The id of the Action.

@Nullable CharSequence label1

The label to display on the first line of the Action.

@Nullable CharSequence label2

The label to display on the second line of the Action.

Action

Added in 1.1.0
public Action(
    long id,
    @Nullable CharSequence label1,
    @Nullable CharSequence label2,
    @Nullable Drawable icon
)

Constructor for an Action.

Parameters
long id

The id of the Action.

@Nullable CharSequence label1

The label to display on the first line of the Action.

@Nullable CharSequence label2

The label to display on the second line of the Action.

@Nullable Drawable icon

The icon to display for the Action.

Public methods

addKeyCode

Added in 1.1.0
public final void addKeyCode(int keyCode)

Adds a keycode used to invoke this Action.

getIcon

Added in 1.1.0
public final @Nullable Drawable getIcon()

Returns the icon drawable for this Action.

getId

Added in 1.1.0
public final long getId()

Returns the id for this Action.

getLabel1

Added in 1.1.0
public final @Nullable CharSequence getLabel1()

Returns the first line label for this Action.

getLabel2

Added in 1.1.0
public final @Nullable CharSequence getLabel2()

Returns the second line label for this Action.

removeKeyCode

Added in 1.1.0
public final void removeKeyCode(int keyCode)

Removes a keycode used to invoke this Action.

respondsToKeyCode

Added in 1.1.0
public final boolean respondsToKeyCode(int keyCode)

Returns true if the Action should respond to the given keycode.

setIcon

Added in 1.1.0
public final void setIcon(@Nullable Drawable icon)

Sets the icon drawable for this Action.

setId

Added in 1.1.0
public final void setId(long id)

Sets the id for this Action.

setLabel1

Added in 1.1.0
public final void setLabel1(@Nullable CharSequence label)

Sets the first line label for this Action.

setLabel2

Added in 1.1.0
public final void setLabel2(@Nullable CharSequence label)

Sets the second line label for this Action.

toString

public @NonNull String toString()