diff --git a/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt b/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt index d6455962..27f08422 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt @@ -1131,12 +1131,13 @@ private fun AlbumsRow( items(items = albums, key = { it.id }) { tile -> val album = tile.value if (album == null) { - SkeletonAlbumTile() + SkeletonAlbumTile(artSize = SECONDARY_ALBUM_ART) } else { AlbumCard( album = album, onClick = { onAlbumClick(album.id) }, onPlay = { onPlayAlbum(album.id) }, + artSize = SECONDARY_ALBUM_ART, ) } } @@ -1394,6 +1395,13 @@ private val ROW_EDGE = 16.dp private val ROW_GAP = 8.dp private val NEXT_CARD_GLIMPSE = 20.dp +// Home's shelves step down in size below the playlists, as on web: Recently +// added keeps the full 144dp album cover, the You might like and Rediscover +// album shelves are smaller, and artist shelves smaller again. The ratios +// follow web's 176 / 144 / 128px minimum tile widths. +private val SECONDARY_ALBUM_ART = 120.dp +private val ARTIST_ART = 104.dp + /** * The 5 system playlist kinds the server generates that aren't pinned * to Home's primary slots. Order matches `systemPlaylistRegistry` in @@ -1418,12 +1426,13 @@ private fun ArtistsRow( items(items = artists, key = { it.id }) { tile -> val artist = tile.value if (artist == null) { - SkeletonArtistTile() + SkeletonArtistTile(artSize = ARTIST_ART) } else { ArtistCard( artist = artist, onClick = { onArtistClick(artist.id) }, onPlay = { onPlayArtist(artist.id) }, + artSize = ARTIST_ART, ) } } diff --git a/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/AlbumCard.kt b/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/AlbumCard.kt index 998b05b8..a929207b 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/AlbumCard.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/AlbumCard.kt @@ -14,6 +14,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.composables.icons.lucide.Disc3 import com.composables.icons.lucide.Lucide @@ -34,6 +35,9 @@ import androidx.compose.ui.Alignment * circular play button is overlaid at the bottom-right of the cover. * Only Home wires it currently; Library / Discover / detail surfaces * leave it null. + * + * [artSize] is the cover's side; the tile is 32dp wider for its padding. + * Home shrinks it on shelves that rank below Recently added. */ @Composable fun AlbumCard( @@ -41,11 +45,12 @@ fun AlbumCard( onClick: () -> Unit, modifier: Modifier = Modifier, onPlay: (suspend () -> Unit)? = null, + artSize: Dp = 144.dp, ) { val seedCache = LocalDetailSeedCache.current Surface( modifier = modifier - .width(176.dp) + .width(artSize + 32.dp) .clickable { seedCache.stashAlbum(album) onClick() @@ -56,7 +61,7 @@ fun AlbumCard( CoverTile( url = album.displayCoverUrl, contentDescription = album.title, - size = 144.dp, + size = artSize, background = MaterialTheme.colorScheme.surfaceVariant, fallback = { Icon( diff --git a/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/ArtistCard.kt b/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/ArtistCard.kt index e426a5d0..f090e253 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/ArtistCard.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/library/widgets/ArtistCard.kt @@ -18,6 +18,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.composables.icons.lucide.Lucide import com.composables.icons.lucide.User @@ -35,6 +36,9 @@ import com.fabledsword.minstrel.shared.widgets.PlayCircleButton * circular play button is overlaid at the bottom-right of the avatar. * Only Home wires it currently. Padding is 4dp instead of 6dp because * the circular avatar pulls the button visually inward at the corner. + * + * [artSize] is the avatar's diameter; the tile is 16dp wider for its + * padding. Home shrinks it on shelves that rank below the album shelves. */ @Composable fun ArtistCard( @@ -42,11 +46,12 @@ fun ArtistCard( onClick: () -> Unit, modifier: Modifier = Modifier, onPlay: (suspend () -> Unit)? = null, + artSize: Dp = 128.dp, ) { val seedCache = LocalDetailSeedCache.current Surface( modifier = modifier - .width(144.dp) + .width(artSize + 16.dp) .clickable { seedCache.stashArtist(artist) onClick() @@ -60,7 +65,7 @@ fun ArtistCard( CoverTile( url = artist.displayCoverUrl, contentDescription = artist.name, - size = 128.dp, + size = artSize, shape = CircleShape, fallback = { Icon( diff --git a/android/app/src/main/java/com/fabledsword/minstrel/shared/widgets/Skeletons.kt b/android/app/src/main/java/com/fabledsword/minstrel/shared/widgets/Skeletons.kt index 93a72f5e..722b4dda 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/shared/widgets/Skeletons.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/shared/widgets/Skeletons.kt @@ -26,6 +26,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.fabledsword.minstrel.theme.FabledSwordFlatTokens @@ -67,17 +68,17 @@ fun SkeletonBox( } /** - * Stand-in for AlbumCard / PlaylistCard (same 176dp×144dp cover + - * 2 caption lines geometry). + * Stand-in for AlbumCard / PlaylistCard (same geometry: an [artSize] + * cover in a tile 32dp wider, and 2 caption lines). */ @Composable -fun SkeletonAlbumTile(modifier: Modifier = Modifier) { +fun SkeletonAlbumTile(modifier: Modifier = Modifier, artSize: Dp = 144.dp) { Column( modifier = modifier - .width(176.dp) + .width(artSize + 32.dp) .padding(horizontal = 8.dp), ) { - SkeletonBox(modifier = Modifier.size(144.dp)) + SkeletonBox(modifier = Modifier.size(artSize)) Spacer(Modifier.height(8.dp)) SkeletonBox(modifier = Modifier.fillMaxWidth().height(14.dp)) Spacer(Modifier.height(4.dp)) @@ -86,18 +87,19 @@ fun SkeletonAlbumTile(modifier: Modifier = Modifier) { } /** - * Stand-in for ArtistCard (128dp circular cover + 1 name line). + * Stand-in for ArtistCard (an [artSize] circular cover in a tile 16dp + * wider, and 1 name line). */ @Composable -fun SkeletonArtistTile(modifier: Modifier = Modifier) { +fun SkeletonArtistTile(modifier: Modifier = Modifier, artSize: Dp = 128.dp) { Column( modifier = modifier - .width(144.dp) + .width(artSize + 16.dp) .padding(horizontal = 8.dp), horizontalAlignment = Alignment.CenterHorizontally, ) { SkeletonBox( - modifier = Modifier.size(128.dp), + modifier = Modifier.size(artSize), shape = CircleShape, ) Spacer(Modifier.height(8.dp))