mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
[ui-compose] Add KDoc to observe() methods for button states
#cherrypick PiperOrigin-RevId: 731686021 (cherry picked from commit b465cbc22c61acc07875550d1c1f24aa5d080f13)
This commit is contained in:
parent
c66c221b28
commit
c7fa2c3de6
@ -56,6 +56,11 @@ class NextButtonState(private val player: Player) {
|
|||||||
player.seekToNext()
|
player.seekToNext()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribes to updates from [Player.Events] and listens to
|
||||||
|
* [Player.EVENT_AVAILABLE_COMMANDS_CHANGED] in order to determine whether the button should be
|
||||||
|
* enabled, i.e. respond to user input.
|
||||||
|
*/
|
||||||
suspend fun observe(): Nothing =
|
suspend fun observe(): Nothing =
|
||||||
player.listen { events ->
|
player.listen { events ->
|
||||||
if (events.contains(Player.EVENT_AVAILABLE_COMMANDS_CHANGED)) {
|
if (events.contains(Player.EVENT_AVAILABLE_COMMANDS_CHANGED)) {
|
||||||
|
@ -79,6 +79,12 @@ class PresentationState(private val player: Player) {
|
|||||||
|
|
||||||
private var lastPeriodUidWithTracks: Any? = null
|
private var lastPeriodUidWithTracks: Any? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribes to updates from [Player.Events] and listens to
|
||||||
|
* * [Player.EVENT_VIDEO_SIZE_CHANGED] to determine pixelWidthHeightRatio-adjusted video size
|
||||||
|
* * [Player.EVENT_RENDERED_FIRST_FRAME] and [Player.EVENT_TRACKS_CHANGED]to determine whether the
|
||||||
|
* surface is ready to be shown
|
||||||
|
*/
|
||||||
suspend fun observe(): Nothing =
|
suspend fun observe(): Nothing =
|
||||||
player.listen { events ->
|
player.listen { events ->
|
||||||
if (events.contains(Player.EVENT_VIDEO_SIZE_CHANGED)) {
|
if (events.contains(Player.EVENT_VIDEO_SIZE_CHANGED)) {
|
||||||
|
@ -56,6 +56,11 @@ class PreviousButtonState(private val player: Player) {
|
|||||||
player.seekToPrevious()
|
player.seekToPrevious()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribes to updates from [Player.Events] and listens to
|
||||||
|
* [Player.EVENT_AVAILABLE_COMMANDS_CHANGED] in order to determine whether the button should be
|
||||||
|
* enabled, i.e. respond to user input.
|
||||||
|
*/
|
||||||
suspend fun observe(): Nothing =
|
suspend fun observe(): Nothing =
|
||||||
player.listen { events ->
|
player.listen { events ->
|
||||||
if (events.contains(Player.EVENT_AVAILABLE_COMMANDS_CHANGED)) {
|
if (events.contains(Player.EVENT_AVAILABLE_COMMANDS_CHANGED)) {
|
||||||
|
@ -80,6 +80,12 @@ class RepeatButtonState(
|
|||||||
player.repeatMode = getNextRepeatModeInSequence()
|
player.repeatMode = getNextRepeatModeInSequence()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribes to updates from [Player.Events] and listens to
|
||||||
|
* * [Player.EVENT_REPEAT_MODE_CHANGED] in order to determine the latest [Player.getRepeatMode].
|
||||||
|
* * [Player.EVENT_AVAILABLE_COMMANDS_CHANGED] in order to determine whether the button should be
|
||||||
|
* enabled, i.e. respond to user input.
|
||||||
|
*/
|
||||||
suspend fun observe(): Nothing =
|
suspend fun observe(): Nothing =
|
||||||
player.listen { events ->
|
player.listen { events ->
|
||||||
if (
|
if (
|
||||||
|
@ -58,6 +58,13 @@ class ShuffleButtonState(private val player: Player) {
|
|||||||
player.shuffleModeEnabled = !player.shuffleModeEnabled
|
player.shuffleModeEnabled = !player.shuffleModeEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribes to updates from [Player.Events] and listens to
|
||||||
|
* * [Player.EVENT_SHUFFLE_MODE_ENABLED_CHANGED] in order to determine the latest
|
||||||
|
* [Player.getShuffleModeEnabled].
|
||||||
|
* * [Player.EVENT_AVAILABLE_COMMANDS_CHANGED] in order to determine whether the button should be
|
||||||
|
* enabled, i.e. respond to user input.
|
||||||
|
*/
|
||||||
suspend fun observe(): Nothing =
|
suspend fun observe(): Nothing =
|
||||||
player.listen { events ->
|
player.listen { events ->
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user