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 Nothing |
observe()Subscribes to updates from |
Unit |
onClick()Handles the interaction with the ShuffleButton according to the current state of the |
Public properties |
|
|---|---|
Boolean |
determined by |
Boolean |
determined by |
Public constructors
Public functions
observe
suspend fun observe(): Nothing
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 must only be programmatically called if the state is enabled. However, it can be freely provided into containers that take care of skipping the onClick if a particular UI node is not enabled (see Compose Clickable Modifier).