Open the fullscreen player when starting a wave or a collection on TV
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7674bcd99f
commit
2a7e1722dc
6 files changed
+29
-5
No files matched your search
@@ -31,6 +31,7 @@ import it.panov.musyx.api.PlaylistId
|
|||||||
import it.panov.musyx.api.Track
|
import it.panov.musyx.api.Track
|
||||||
import it.panov.musyx.state.AppState
|
import it.panov.musyx.state.AppState
|
||||||
import it.panov.musyx.state.PlaylistSlot
|
import it.panov.musyx.state.PlaylistSlot
|
||||||
|
import it.panov.musyx.state.Route
|
||||||
import it.panov.musyx.state.Sheet
|
import it.panov.musyx.state.Sheet
|
||||||
import it.panov.musyx.tv.ui.artistsOrUnknown
|
import it.panov.musyx.tv.ui.artistsOrUnknown
|
||||||
import it.panov.musyx.tv.ui.clock
|
import it.panov.musyx.tv.ui.clock
|
||||||
@@ -190,6 +191,19 @@ fun ShiftMarker(shift: Int) {
|
|||||||
Text(glyph, style = MusyxTheme.type.small, color = colour, modifier = Modifier.width(18.dp), textAlign = TextAlign.Center)
|
Text(glyph, style = MusyxTheme.type.small, color = colour, modifier = Modifier.width(18.dp), textAlign = TextAlign.Center)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Plays a whole list from the top and opens the player, as Play and Shuffle do. */
|
||||||
|
fun AppState.playTracksOpen(tracks: List<Track>, shuffle: Boolean = false) {
|
||||||
|
if (tracks.isEmpty()) return
|
||||||
|
playTracks(tracks, 0, shuffle)
|
||||||
|
navigate(Route.NowPlaying)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Starts a wave and opens the player, so tuning in lands on the full-screen view. */
|
||||||
|
fun AppState.playWaveOpen(station: String) {
|
||||||
|
playWave(station)
|
||||||
|
navigate(Route.NowPlaying)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Play and Shuffle, then any page actions (the heart), then a summary. Shared by every page
|
* Play and Shuffle, then any page actions (the heart), then a summary. Shared by every page
|
||||||
* with tracks.
|
* with tracks.
|
||||||
@@ -211,14 +225,14 @@ fun PlayBar(
|
|||||||
) {
|
) {
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
stringResource(R.string.action_play),
|
stringResource(R.string.action_play),
|
||||||
onClick = { state.playTracks(tracks, 0) },
|
onClick = { state.playTracksOpen(tracks) },
|
||||||
icon = R.drawable.ic_play_fill,
|
icon = R.drawable.ic_play_fill,
|
||||||
enabled = tracks.isNotEmpty(),
|
enabled = tracks.isNotEmpty(),
|
||||||
modifier = Modifier.entry(entry),
|
modifier = Modifier.entry(entry),
|
||||||
)
|
)
|
||||||
GhostButton(
|
GhostButton(
|
||||||
stringResource(R.string.action_shuffle),
|
stringResource(R.string.action_shuffle),
|
||||||
onClick = { state.playTracks(tracks, 0, shuffle = true) },
|
onClick = { state.playTracksOpen(tracks, shuffle = true) },
|
||||||
icon = R.drawable.ic_shuffle,
|
icon = R.drawable.ic_shuffle,
|
||||||
enabled = tracks.isNotEmpty(),
|
enabled = tracks.isNotEmpty(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import it.panov.musyx.tv.ui.components.ShelfRow
|
|||||||
import it.panov.musyx.tv.ui.components.ChoiceRow
|
import it.panov.musyx.tv.ui.components.ChoiceRow
|
||||||
import coil3.compose.AsyncImage
|
import coil3.compose.AsyncImage
|
||||||
import it.panov.musyx.tv.ui.components.FocusEntry
|
import it.panov.musyx.tv.ui.components.FocusEntry
|
||||||
|
import it.panov.musyx.tv.ui.components.playWaveOpen
|
||||||
import it.panov.musyx.tv.ui.components.Focusable
|
import it.panov.musyx.tv.ui.components.Focusable
|
||||||
import it.panov.musyx.tv.ui.components.Note
|
import it.panov.musyx.tv.ui.components.Note
|
||||||
import it.panov.musyx.tv.ui.components.PrimaryButton
|
import it.panov.musyx.tv.ui.components.PrimaryButton
|
||||||
@@ -147,7 +148,7 @@ fun WaveHero(state: AppState, big: Boolean, entry: FocusEntry?) {
|
|||||||
}
|
}
|
||||||
val (label, icon, action) = when (status) {
|
val (label, icon, action) = when (status) {
|
||||||
Status.Playing, Status.Loading -> Triple(R.string.action_pause, R.drawable.ic_pause_fill) { state.playback.toggle() }
|
Status.Playing, Status.Loading -> Triple(R.string.action_pause, R.drawable.ic_pause_fill) { state.playback.toggle() }
|
||||||
null -> Triple(R.string.wave_play, R.drawable.ic_play_fill) { state.playWave(MY_WAVE) }
|
null -> Triple(R.string.wave_play, R.drawable.ic_play_fill) { state.playWaveOpen(MY_WAVE) }
|
||||||
else -> Triple(R.string.action_resume, R.drawable.ic_play_fill) { state.playback.toggle() }
|
else -> Triple(R.string.action_resume, R.drawable.ic_play_fill) { state.playback.toggle() }
|
||||||
}
|
}
|
||||||
val shape = RoundedCornerShape(MusyxTheme.radius.hero)
|
val shape = RoundedCornerShape(MusyxTheme.radius.hero)
|
||||||
@@ -282,7 +283,7 @@ fun WaveScreen(state: AppState, entry: FocusEntry) {
|
|||||||
item(key = "stations-row") {
|
item(key = "stations-row") {
|
||||||
ShelfRow { first ->
|
ShelfRow { first ->
|
||||||
itemsIndexed(others, key = { _, s -> s.id }) { i, s ->
|
itemsIndexed(others, key = { _, s -> s.id }) { i, s ->
|
||||||
StationTile(s, playing = state.playback.state.waveStation == s.id, if (i == 0) first else Modifier) { state.playWave(s.id) }
|
StationTile(s, playing = state.playback.state.waveStation == s.id, if (i == 0) first else Modifier) { state.playWaveOpen(s.id) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import it.panov.musyx.tv.ui.components.CardGrid
|
|||||||
import it.panov.musyx.tv.ui.components.Chip
|
import it.panov.musyx.tv.ui.components.Chip
|
||||||
import it.panov.musyx.tv.ui.components.Failure
|
import it.panov.musyx.tv.ui.components.Failure
|
||||||
import it.panov.musyx.tv.ui.components.FocusEntry
|
import it.panov.musyx.tv.ui.components.FocusEntry
|
||||||
|
import it.panov.musyx.tv.ui.components.playWaveOpen
|
||||||
import it.panov.musyx.tv.ui.components.Note
|
import it.panov.musyx.tv.ui.components.Note
|
||||||
import it.panov.musyx.tv.ui.components.PlayBar
|
import it.panov.musyx.tv.ui.components.PlayBar
|
||||||
import it.panov.musyx.tv.ui.components.PrimaryButton
|
import it.panov.musyx.tv.ui.components.PrimaryButton
|
||||||
@@ -191,7 +192,7 @@ fun GenreScreen(state: AppState, index: Int, entry: FocusEntry) {
|
|||||||
Box(Modifier.weight(1f)) { ScreenTitle(genre.title) }
|
Box(Modifier.weight(1f)) { ScreenTitle(genre.title) }
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
stringResource(R.string.action_play_radio),
|
stringResource(R.string.action_play_radio),
|
||||||
onClick = { state.playWave("genre:${genre.id}") },
|
onClick = { state.playWaveOpen("genre:${genre.id}") },
|
||||||
icon = R.drawable.ic_audio_lines,
|
icon = R.drawable.ic_audio_lines,
|
||||||
modifier = Modifier.entry(entry),
|
modifier = Modifier.entry(entry),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ import it.panov.musyx.tv.ui.components.FocusEntry
|
|||||||
import it.panov.musyx.tv.ui.components.Focusable
|
import it.panov.musyx.tv.ui.components.Focusable
|
||||||
import it.panov.musyx.tv.ui.components.IconButton
|
import it.panov.musyx.tv.ui.components.IconButton
|
||||||
import it.panov.musyx.tv.ui.components.MusyxIcon
|
import it.panov.musyx.tv.ui.components.MusyxIcon
|
||||||
|
import it.panov.musyx.tv.ui.components.Note
|
||||||
import it.panov.musyx.tv.ui.components.PrimaryButton
|
import it.panov.musyx.tv.ui.components.PrimaryButton
|
||||||
import it.panov.musyx.tv.ui.components.Tab
|
import it.panov.musyx.tv.ui.components.Tab
|
||||||
import it.panov.musyx.tv.ui.components.TabBar
|
import it.panov.musyx.tv.ui.components.TabBar
|
||||||
@@ -123,6 +124,11 @@ fun NowPlayingScreen(state: AppState, entry: FocusEntry) {
|
|||||||
val c = MusyxTheme.colors
|
val c = MusyxTheme.colors
|
||||||
val space = MusyxTheme.space
|
val space = MusyxTheme.space
|
||||||
val track = p.track
|
val track = p.track
|
||||||
|
// A wave fetches its first track after the player opens: say so rather than "nothing".
|
||||||
|
if (track == null && p.status == Status.Loading) {
|
||||||
|
Note(stringResource(R.string.loading_wave), Modifier.padding(vertical = space.safeY))
|
||||||
|
return
|
||||||
|
}
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Column(
|
Column(
|
||||||
Modifier.fillMaxSize().padding(horizontal = space.safeX, vertical = space.safeY),
|
Modifier.fillMaxSize().padding(horizontal = space.safeX, vertical = space.safeY),
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
<string name="loading_playlist">Загружаем плейлист…</string>
|
<string name="loading_playlist">Загружаем плейлист…</string>
|
||||||
<string name="loading_wave_settings">Загружаем настройки…</string>
|
<string name="loading_wave_settings">Загружаем настройки…</string>
|
||||||
<string name="loading_stations">Загружаем станции…</string>
|
<string name="loading_stations">Загружаем станции…</string>
|
||||||
|
<string name="loading_wave">Настраиваемся на волну…</string>
|
||||||
<string name="what_home">главную страницу</string>
|
<string name="what_home">главную страницу</string>
|
||||||
<string name="what_chart">чарт</string>
|
<string name="what_chart">чарт</string>
|
||||||
<string name="what_genres">жанры</string>
|
<string name="what_genres">жанры</string>
|
||||||
|
|||||||
@@ -95,6 +95,7 @@
|
|||||||
<string name="loading_playlist">Loading the playlist…</string>
|
<string name="loading_playlist">Loading the playlist…</string>
|
||||||
<string name="loading_wave_settings">Loading your settings…</string>
|
<string name="loading_wave_settings">Loading your settings…</string>
|
||||||
<string name="loading_stations">Loading stations…</string>
|
<string name="loading_stations">Loading stations…</string>
|
||||||
|
<string name="loading_wave">Tuning in…</string>
|
||||||
<string name="what_home">your home page</string>
|
<string name="what_home">your home page</string>
|
||||||
<string name="what_chart">the chart</string>
|
<string name="what_chart">the chart</string>
|
||||||
<string name="what_genres">genres</string>
|
<string name="what_genres">genres</string>
|
||||||
|
|||||||
Reference in new issue
Block a user