feat(android): tall playlist cards on a phone held upright, two in view
release / web (push) Successful in 1m24s
release / go (push) Successful in 2m2s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m2s
release / android (push) Failing after 4m1s
release / Build signed APK (push) Failing after 4m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m24s
release / go (push) Successful in 2m2s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m2s
release / android (push) Failing after 4m1s
release / Build signed APK (push) Failing after 4m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
Below 600dp the Playlists shelf's wide cards left one playlist in view. There the shelf now uses tall cards: the cover on top, and under it the cover-coloured panel with the name, what the mix is built from and the play button, sized so two show whole with a glimpse of the third. Wider screens keep the wide cards; placeholders follow the same switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,8 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
@@ -89,6 +91,7 @@ import com.fabledsword.minstrel.playlists.widgets.GenreBandCard
|
||||
import com.fabledsword.minstrel.playlists.widgets.PlaceholderShape
|
||||
import com.fabledsword.minstrel.playlists.widgets.PlaylistPlaceholderCard
|
||||
import com.fabledsword.minstrel.playlists.widgets.SongsLikeCard
|
||||
import com.fabledsword.minstrel.playlists.widgets.TallPlaylistCard
|
||||
import com.fabledsword.minstrel.playlists.widgets.WidePlaylistCard
|
||||
import com.fabledsword.minstrel.shared.UiState
|
||||
import com.fabledsword.minstrel.shared.UpdateVeilController
|
||||
@@ -1160,6 +1163,7 @@ private fun PlaylistsRow(
|
||||
reals.map { it.id }.zip(assignShelfCovers(reals, shape.coversPerTile)).toMap()
|
||||
}
|
||||
val meta = remember(reals) { shelfMeta(reals) }
|
||||
val tallWidth = tallCardWidth(shape)
|
||||
HorizontalScrollRow(title = title, meta = meta) {
|
||||
itemsIndexed(items = rowItems) { _, item ->
|
||||
when (item) {
|
||||
@@ -1170,6 +1174,7 @@ private fun PlaylistsRow(
|
||||
)
|
||||
is PlaylistRowItem.Real -> ShelfTile(
|
||||
shape = shape,
|
||||
tallWidth = tallWidth,
|
||||
playlist = item.playlist,
|
||||
covers = covers[item.playlist.id].orEmpty(),
|
||||
// Greyed offline when the tile needs the live server or
|
||||
@@ -1182,17 +1187,35 @@ private fun PlaylistsRow(
|
||||
is PlaylistRowItem.Placeholder -> PlaylistPlaceholderCard(
|
||||
label = item.label,
|
||||
variant = item.variant,
|
||||
shape = shape.placeholder,
|
||||
shape = if (tallWidth != null) PlaceholderShape.TALL else shape.placeholder,
|
||||
modifier = if (tallWidth != null) Modifier.width(tallWidth) else Modifier,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** One playlist tile in its shelf's shape. */
|
||||
/**
|
||||
* On a narrow screen (a phone held upright) the wide shelf would leave one
|
||||
* playlist in view, so it switches to tall cards sized for two whole cards
|
||||
* and a glimpse of the third. Null keeps the shelf's own shape.
|
||||
*/
|
||||
@Composable
|
||||
private fun tallCardWidth(shape: ShelfShape): Dp? {
|
||||
val screen = LocalConfiguration.current.screenWidthDp.dp
|
||||
return if (shape == ShelfShape.WIDE && screen < COMPACT_WIDTH) {
|
||||
// Row padding at the start, two gaps between cards, the third's glimpse.
|
||||
(screen - ROW_EDGE - ROW_GAP * 2 - NEXT_CARD_GLIMPSE) / 2
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
/** One playlist tile in its shelf's shape; a wide one turns tall at [tallWidth]. */
|
||||
@Composable
|
||||
private fun ShelfTile(
|
||||
shape: ShelfShape,
|
||||
tallWidth: Dp?,
|
||||
playlist: PlaylistRef,
|
||||
covers: List<String>,
|
||||
greyed: Boolean,
|
||||
@@ -1200,10 +1223,11 @@ private fun ShelfTile(
|
||||
onPlay: suspend () -> Unit,
|
||||
) {
|
||||
val playEnabled = playlist.trackCount > 0
|
||||
when (shape) {
|
||||
ShelfShape.WIDE -> WidePlaylistCard(playlist, covers, onClick, onPlay, playEnabled, greyed)
|
||||
ShelfShape.ROUND -> SongsLikeCard(playlist, covers, onClick, onPlay, playEnabled, greyed)
|
||||
ShelfShape.BAND -> GenreBandCard(playlist, covers, onClick, onPlay, playEnabled, greyed)
|
||||
when {
|
||||
tallWidth != null -> TallPlaylistCard(playlist, covers, tallWidth, onClick, onPlay, playEnabled, greyed)
|
||||
shape == ShelfShape.WIDE -> WidePlaylistCard(playlist, covers, onClick, onPlay, playEnabled, greyed)
|
||||
shape == ShelfShape.ROUND -> SongsLikeCard(playlist, covers, onClick, onPlay, playEnabled, greyed)
|
||||
else -> GenreBandCard(playlist, covers, onClick, onPlay, playEnabled, greyed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1363,6 +1387,13 @@ private fun variantFor(slot: String, s: SystemPlaylistsStatus): String = when {
|
||||
// once generated, are shown in full, uncapped.
|
||||
private const val SONGS_LIKE_PLACEHOLDER_SLOTS = 3
|
||||
|
||||
// Below this width (a phone held upright) the Playlists shelf uses tall
|
||||
// cards; the 600dp line is Material's compact width class.
|
||||
private val COMPACT_WIDTH = 600.dp
|
||||
private val ROW_EDGE = 16.dp
|
||||
private val ROW_GAP = 8.dp
|
||||
private val NEXT_CARD_GLIMPSE = 20.dp
|
||||
|
||||
/**
|
||||
* The 5 system playlist kinds the server generates that aren't pinned
|
||||
* to Home's primary slots. Order matches `systemPlaylistRegistry` in
|
||||
|
||||
+5
-2
@@ -1,4 +1,7 @@
|
||||
package com.fabledsword.minstrel.playlists.widgets
|
||||
|
||||
/** Which shelf a placeholder stands in for; it takes that shelf's tile shape. */
|
||||
enum class PlaceholderShape { SQUARE, WIDE, ROUND }
|
||||
/**
|
||||
* Which shelf a placeholder stands in for; it takes that shelf's tile shape.
|
||||
* TALL fills the width its caller gives it, like [TallPlaylistCard].
|
||||
*/
|
||||
enum class PlaceholderShape { SQUARE, WIDE, TALL, ROUND }
|
||||
|
||||
+15
-2
@@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
@@ -52,13 +54,24 @@ fun PlaylistPlaceholderCard(
|
||||
return
|
||||
}
|
||||
val round = shape == PlaceholderShape.ROUND
|
||||
val tall = shape == PlaceholderShape.TALL
|
||||
Column(
|
||||
modifier = modifier.width(if (round) 136.dp else 176.dp).padding(horizontal = 8.dp),
|
||||
modifier = if (tall) {
|
||||
modifier
|
||||
} else {
|
||||
modifier.width(if (round) 136.dp else 176.dp).padding(horizontal = 8.dp)
|
||||
},
|
||||
horizontalAlignment = if (round) Alignment.CenterHorizontally else Alignment.Start,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(if (round) 120.dp else 144.dp)
|
||||
.then(
|
||||
if (tall) {
|
||||
Modifier.fillMaxWidth().aspectRatio(1f)
|
||||
} else {
|
||||
Modifier.size(if (round) 120.dp else 144.dp)
|
||||
},
|
||||
)
|
||||
.clip(if (round) CircleShape else RoundedCornerShape(FabledSwordFlatTokens.radiusSm))
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant),
|
||||
contentAlignment = Alignment.Center,
|
||||
|
||||
+17
-15
@@ -256,7 +256,7 @@ private fun CoverFan(urls: List<String>, modifier: Modifier = Modifier) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LeadArt(url: String?, modifier: Modifier) {
|
||||
internal fun LeadArt(url: String?, modifier: Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.fillMaxHeight()
|
||||
@@ -273,7 +273,7 @@ private fun LeadArt(url: String?, modifier: Modifier) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NoArtIcon() {
|
||||
internal fun NoArtIcon() {
|
||||
Icon(
|
||||
imageVector = Lucide.ListMusic,
|
||||
contentDescription = null,
|
||||
@@ -283,7 +283,7 @@ private fun NoArtIcon() {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Modifier.stashingClick(playlist: PlaylistRef, onClick: () -> Unit): Modifier {
|
||||
internal fun Modifier.stashingClick(playlist: PlaylistRef, onClick: () -> Unit): Modifier {
|
||||
val seedCache = LocalDetailSeedCache.current
|
||||
return clickable {
|
||||
seedCache.stashPlaylist(playlist)
|
||||
@@ -297,7 +297,7 @@ private fun Modifier.stashingClick(playlist: PlaylistRef, onClick: () -> Unit):
|
||||
* until the colour is known, or when there is no cover.
|
||||
*/
|
||||
@Composable
|
||||
private fun rememberWash(url: String?): Color {
|
||||
internal fun rememberWash(url: String?): Color {
|
||||
val dominant = rememberDominantColor(url)
|
||||
if (dominant == Color.Transparent) return NeutralWash
|
||||
val toned = washTone(
|
||||
@@ -312,18 +312,20 @@ private fun rememberWash(url: String?): Color {
|
||||
|
||||
/**
|
||||
* The tile background: the wash darkened toward near-black, 62% wash at the
|
||||
* art end fading to 30%. With [washTone]'s caps this keeps [OnWash] text at
|
||||
* 4.5:1 or better on any cover (ShelfTest checks the numbers).
|
||||
* art end fading to 30% (left to right, or top to bottom when [vertical]).
|
||||
* With [washTone]'s caps this keeps [OnWash] text at 4.5:1 or better on any
|
||||
* cover (ShelfTest checks the numbers).
|
||||
*/
|
||||
private fun washBrush(wash: Color): Brush = Brush.horizontalGradient(
|
||||
listOf(lerp(WashBase, wash, WASH_NEAR), lerp(WashBase, wash, WASH_FAR)),
|
||||
)
|
||||
internal fun washBrush(wash: Color, vertical: Boolean = false): Brush {
|
||||
val stops = listOf(lerp(WashBase, wash, WASH_NEAR), lerp(WashBase, wash, WASH_FAR))
|
||||
return if (vertical) Brush.verticalGradient(stops) else Brush.horizontalGradient(stops)
|
||||
}
|
||||
|
||||
private fun leadCoverUrl(playlist: PlaylistRef, covers: List<String>): String? =
|
||||
internal fun leadCoverUrl(playlist: PlaylistRef, covers: List<String>): String? =
|
||||
covers.firstOrNull()?.let(::albumCoverPath) ?: playlist.coverUrl.ifEmpty { null }
|
||||
|
||||
/** A system mix says what it is built from; anything else says its size and owner. */
|
||||
private fun sublineFor(p: PlaylistRef): String =
|
||||
internal fun sublineFor(p: PlaylistRef): String =
|
||||
if (p.isSystem && p.description.isNotEmpty()) {
|
||||
p.description
|
||||
} else {
|
||||
@@ -334,7 +336,7 @@ private fun sublineFor(p: PlaylistRef): String =
|
||||
// The wash is dark in both themes, so its text is the dark theme's light
|
||||
// parchment in both themes too; the theme-switching tokens would turn it
|
||||
// dark in light mode and lose the contrast.
|
||||
private val OnWash = FabledSwordDarkTokens.parchment
|
||||
internal val OnWash = FabledSwordDarkTokens.parchment
|
||||
private val WashBase = Color(red = 14, green = 16, blue = 19)
|
||||
private val NeutralWash = Color(red = 44, green = 49, blue = 58)
|
||||
|
||||
@@ -350,7 +352,7 @@ private val BAND_WIDTH = 280.dp
|
||||
private val BAND_HEIGHT = 122.dp
|
||||
private val ROUND_WIDTH = 136.dp
|
||||
private val ROUND_SIZE = 120.dp
|
||||
private val CARD_RADIUS = 12.dp
|
||||
internal val CARD_RADIUS = 12.dp
|
||||
private val FAN_COVER = 95.dp
|
||||
private val MICRO_LABEL_TRACKING = 0.9.sp
|
||||
|
||||
@@ -362,6 +364,6 @@ private const val NAME_MAX_FRACTION = 0.85f
|
||||
private const val NAME_SHADOW_ALPHA = 0.6f
|
||||
private const val WASH_NEAR = 0.62f
|
||||
private const val WASH_FAR = 0.30f
|
||||
private const val ON_WASH_2 = 0.9f
|
||||
private const val GREYED_ALPHA = 0.45f
|
||||
internal const val ON_WASH_2 = 0.9f
|
||||
internal const val GREYED_ALPHA = 0.45f
|
||||
private const val CHANNEL_MAX = 255f
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.fabledsword.minstrel.playlists.widgets
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.fabledsword.minstrel.models.PlaylistRef
|
||||
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
||||
|
||||
/**
|
||||
* The phone-portrait form of [WidePlaylistCard], for screens where a wide
|
||||
* card would leave only one playlist in view: the lead cover on top, and
|
||||
* under it a panel washed in the cover's colour holding the name, what the
|
||||
* mix is built from, and the play button, which sits on the panel and never
|
||||
* over the art. [width] is chosen by the shelf so two cards show whole.
|
||||
*/
|
||||
@Composable
|
||||
fun TallPlaylistCard(
|
||||
playlist: PlaylistRef,
|
||||
covers: List<String>,
|
||||
width: Dp,
|
||||
onClick: () -> Unit,
|
||||
onPlay: suspend () -> Unit,
|
||||
playEnabled: Boolean,
|
||||
greyed: Boolean,
|
||||
) {
|
||||
val lead = leadCoverUrl(playlist, covers)
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.width(width)
|
||||
.alpha(if (greyed) GREYED_ALPHA else 1f)
|
||||
.clip(RoundedCornerShape(CARD_RADIUS))
|
||||
.background(washBrush(rememberWash(lead), vertical = true))
|
||||
.stashingClick(playlist, onClick),
|
||||
) {
|
||||
LeadArt(url = lead, modifier = Modifier.fillMaxWidth().aspectRatio(1f))
|
||||
Box(modifier = Modifier.fillMaxWidth().height(TALL_PANEL_HEIGHT)) {
|
||||
Column(modifier = Modifier.padding(start = 10.dp, top = 8.dp, end = 10.dp, bottom = 8.dp)) {
|
||||
Text(
|
||||
text = playlist.name,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
color = OnWash,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
Spacer(Modifier.height(2.dp))
|
||||
Text(
|
||||
text = sublineFor(playlist),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = OnWash.copy(alpha = ON_WASH_2),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
// Leaves the play button's corner clear.
|
||||
modifier = Modifier.padding(end = 40.dp),
|
||||
)
|
||||
}
|
||||
PlayCircleButton(
|
||||
onPlay = onPlay,
|
||||
enabled = playEnabled && !greyed,
|
||||
size = 36.dp,
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomEnd)
|
||||
.padding(8.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Name, two lines of description, and room for the play button under them.
|
||||
private val TALL_PANEL_HEIGHT = 96.dp
|
||||
Reference in New Issue
Block a user