ShuffleButtonState
@UnstableApi
class ShuffleButtonState
State that holds all interactions to correctly deal with a UI component representing a Shuffle On/Off button.
Summary
Public constructors |
|---|
ShuffleButtonState(player: Player?) |
Public functions |
|
|---|---|
suspend Unit |
observe()Subscribes to updates from |
Unit |
onClick()Handles the interaction with the ShuffleButton according to the current state of the |
Public properties |
|
|---|---|
Boolean |
true if |
Boolean |
true if |
Public constructors
Public functions
observe
suspend fun observe(): Unit
Subscribes to updates from Player.Events and listens to
-
Player.EVENT_SHUFFLE_MODE_ENABLED_CHANGEDin order to determine the latestPlayer.getShuffleModeEnabled. -
Player.EVENT_AVAILABLE_COMMANDS_CHANGEDin order to determine whether the button should be enabled, i.e. respond to user input.
onClick
fun onClick(): Unit
Handles the interaction with the ShuffleButton according to the current state of the Player.
This method does nothing if Player.COMMAND_SET_SHUFFLE_MODE is not available
Public properties
isEnabled
val isEnabled: Boolean
true if player is not null and Player.COMMAND_SET_SHUFFLE_MODE is available.