MediaSession.CommandButton.Builder

Added in 1.0.0
Deprecated in 1.3.0

class MediaSession.CommandButton.Builder


Builder for CommandButton.

Summary

Public constructors

Public functions

MediaSession.CommandButton

Builds the CommandButton.

MediaSession.CommandButton.Builder

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

MediaSession.CommandButton.Builder

Sets the display name of the button.

MediaSession.CommandButton.Builder
setEnabled(enabled: Boolean)

Sets whether the button is enabled.

MediaSession.CommandButton.Builder
setExtras(extras: Bundle?)

Sets the extras of the button.

MediaSession.CommandButton.Builder
setIconResId(resId: Int)

Sets the bitmap-type (e.g. PNG) icon resource id of the button.

Public constructors

Builder

Added in 1.0.0
Deprecated in 1.3.0
Builder()

Public functions

build

Added in 1.0.0
Deprecated in 1.3.0
fun build(): MediaSession.CommandButton

Builds the CommandButton.

setCommand

Added in 1.0.0
Deprecated in 1.3.0
fun setCommand(command: SessionCommand?): MediaSession.CommandButton.Builder

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

Parameters
command: SessionCommand?

session command

setDisplayName

Added in 1.0.0
Deprecated in 1.3.0
fun setDisplayName(displayName: CharSequence?): MediaSession.CommandButton.Builder

Sets the display name of the button.

Parameters
displayName: CharSequence?

display name of the button

setEnabled

Added in 1.0.0
Deprecated in 1.3.0
fun setEnabled(enabled: Boolean): MediaSession.CommandButton.Builder

Sets whether the button is enabled. Can be false to indicate that the button should be shown but isn't clickable.

Parameters
enabled: Boolean

true if the button is enabled and ready. false otherwise.

setExtras

Added in 1.0.0
Deprecated in 1.3.0
fun setExtras(extras: Bundle?): MediaSession.CommandButton.Builder

Sets the extras of the button.

Parameters
extras: Bundle?

extras information of the button

setIconResId

Added in 1.0.0
Deprecated in 1.3.0
fun setIconResId(resId: Int): MediaSession.CommandButton.Builder

Sets the bitmap-type (e.g. PNG) icon resource id of the button.

None bitmap type (e.g. VectorDrawabale) may cause unexpected behavior when it's sent to MediaController app, so please avoid using it especially for the older platform (API <21).

Parameters
resId: Int

resource id of the button