CommandButton.Builder


public final class CommandButton.Builder


A builder for CommandButton.

Summary

Public constructors

Creates a builder.

Public methods

CommandButton

Builds a CommandButton.

CommandButton.Builder

Sets a display name of this button.

CommandButton.Builder

Sets whether the button is enabled.

CommandButton.Builder

Sets an extra Bundle of this button.

CommandButton.Builder

Sets the resource id of a bitmap (e.g. PNG) icon of this button.

CommandButton.Builder

Sets a Uri for the icon of this button.

CommandButton.Builder

Sets the Player.Command that would be sent to the session when the button is clicked.

CommandButton.Builder

Sets the SessionCommand that will be sent to the session when the button is clicked.

Public constructors

Builder

public Builder()

Creates a builder.

Public methods

build

public CommandButton build()

Builds a CommandButton.

setDisplayName

@CanIgnoreReturnValue
public CommandButton.Builder setDisplayName(CharSequence displayName)

Sets a display name of this button.

Parameters
CharSequence displayName

The display name.

Returns
CommandButton.Builder

This builder for chaining.

setEnabled

@CanIgnoreReturnValue
public CommandButton.Builder setEnabled(boolean enabled)

Sets whether the button is enabled.

Parameters
boolean enabled

Whether the button is enabled.

Returns
CommandButton.Builder

This builder for chaining.

setExtras

@CanIgnoreReturnValue
public CommandButton.Builder setExtras(Bundle extras)

Sets an extra Bundle of this button.

Parameters
Bundle extras

The extra Bundle.

Returns
CommandButton.Builder

This builder for chaining.

setIconResId

@CanIgnoreReturnValue
public CommandButton.Builder setIconResId(@DrawableRes int resId)

Sets the resource id of a bitmap (e.g. PNG) icon of this button.

Non-bitmap (e.g. VectorDrawable) may cause unexpected behavior in a app, so please avoid using it especially for the older platforms ( SDK_INT < 21).

Parameters
@DrawableRes int resId

The resource id of an icon.

Returns
CommandButton.Builder

This builder for chaining.

setIconUri

@UnstableApi
@CanIgnoreReturnValue
public CommandButton.Builder setIconUri(Uri uri)

Sets a Uri for the icon of this button.

Parameters
Uri uri

The uri to an icon.

Returns
CommandButton.Builder

This builder for chaining.

setPlayerCommand

@CanIgnoreReturnValue
public CommandButton.Builder setPlayerCommand(@Player.Command int playerCommand)

Sets the Player.Command that would be sent to the session when the button is clicked. Cannot set this if session command is already set via setSessionCommand.

Parameters
@Player.Command int playerCommand

The player command.

Returns
CommandButton.Builder

This builder for chaining.

setSessionCommand

@CanIgnoreReturnValue
public CommandButton.Builder setSessionCommand(SessionCommand sessionCommand)

Sets the SessionCommand that will be sent to the session when the button is clicked. Cannot set this if player command is already set via setPlayerCommand.

Parameters
SessionCommand sessionCommand

The session command.

Returns
CommandButton.Builder

This builder for chaining.