CommandButton.Builder


class CommandButton.Builder


A builder for CommandButton.

Summary

Public constructors

Creates a builder.

Public functions

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

Builder()

Creates a builder.

Public functions

build

fun build(): CommandButton!

Builds a CommandButton.

setDisplayName

@CanIgnoreReturnValue
fun setDisplayName(displayName: CharSequence!): CommandButton.Builder!

Sets a display name of this button.

Parameters
displayName: CharSequence!

The display name.

Returns
CommandButton.Builder!

This builder for chaining.

setEnabled

@CanIgnoreReturnValue
fun setEnabled(enabled: Boolean): CommandButton.Builder!

Sets whether the button is enabled.

Parameters
enabled: Boolean

Whether the button is enabled.

Returns
CommandButton.Builder!

This builder for chaining.

setExtras

@CanIgnoreReturnValue
fun setExtras(extras: Bundle!): CommandButton.Builder!

Sets an extra Bundle of this button.

Parameters
extras: Bundle!

The extra Bundle.

Returns
CommandButton.Builder!

This builder for chaining.

setIconResId

@CanIgnoreReturnValue
fun setIconResId(resId: @DrawableRes Int): CommandButton.Builder!

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
resId: @DrawableRes Int

The resource id of an icon.

Returns
CommandButton.Builder!

This builder for chaining.

setIconUri

@UnstableApi
@CanIgnoreReturnValue
fun setIconUri(uri: Uri!): CommandButton.Builder!

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
fun setPlayerCommand(@Player.Command playerCommand: Int): CommandButton.Builder!

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 playerCommand: Int

The player command.

Returns
CommandButton.Builder!

This builder for chaining.

setSessionCommand

@CanIgnoreReturnValue
fun setSessionCommand(sessionCommand: SessionCommand!): CommandButton.Builder!

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.