The first public release of Fabled Minstrel #158
@@ -1131,12 +1131,13 @@ private fun AlbumsRow(
|
|||||||
items(items = albums, key = { it.id }) { tile ->
|
items(items = albums, key = { it.id }) { tile ->
|
||||||
val album = tile.value
|
val album = tile.value
|
||||||
if (album == null) {
|
if (album == null) {
|
||||||
SkeletonAlbumTile()
|
SkeletonAlbumTile(artSize = SECONDARY_ALBUM_ART)
|
||||||
} else {
|
} else {
|
||||||
AlbumCard(
|
AlbumCard(
|
||||||
album = album,
|
album = album,
|
||||||
onClick = { onAlbumClick(album.id) },
|
onClick = { onAlbumClick(album.id) },
|
||||||
onPlay = { onPlayAlbum(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 ROW_GAP = 8.dp
|
||||||
private val NEXT_CARD_GLIMPSE = 20.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
|
* The 5 system playlist kinds the server generates that aren't pinned
|
||||||
* to Home's primary slots. Order matches `systemPlaylistRegistry` in
|
* to Home's primary slots. Order matches `systemPlaylistRegistry` in
|
||||||
@@ -1418,12 +1426,13 @@ private fun ArtistsRow(
|
|||||||
items(items = artists, key = { it.id }) { tile ->
|
items(items = artists, key = { it.id }) { tile ->
|
||||||
val artist = tile.value
|
val artist = tile.value
|
||||||
if (artist == null) {
|
if (artist == null) {
|
||||||
SkeletonArtistTile()
|
SkeletonArtistTile(artSize = ARTIST_ART)
|
||||||
} else {
|
} else {
|
||||||
ArtistCard(
|
ArtistCard(
|
||||||
artist = artist,
|
artist = artist,
|
||||||
onClick = { onArtistClick(artist.id) },
|
onClick = { onArtistClick(artist.id) },
|
||||||
onPlay = { onPlayArtist(artist.id) },
|
onPlay = { onPlayArtist(artist.id) },
|
||||||
|
artSize = ARTIST_ART,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.composables.icons.lucide.Disc3
|
import com.composables.icons.lucide.Disc3
|
||||||
import com.composables.icons.lucide.Lucide
|
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.
|
* circular play button is overlaid at the bottom-right of the cover.
|
||||||
* Only Home wires it currently; Library / Discover / detail surfaces
|
* Only Home wires it currently; Library / Discover / detail surfaces
|
||||||
* leave it null.
|
* 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
|
@Composable
|
||||||
fun AlbumCard(
|
fun AlbumCard(
|
||||||
@@ -41,11 +45,12 @@ fun AlbumCard(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onPlay: (suspend () -> Unit)? = null,
|
onPlay: (suspend () -> Unit)? = null,
|
||||||
|
artSize: Dp = 144.dp,
|
||||||
) {
|
) {
|
||||||
val seedCache = LocalDetailSeedCache.current
|
val seedCache = LocalDetailSeedCache.current
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.width(176.dp)
|
.width(artSize + 32.dp)
|
||||||
.clickable {
|
.clickable {
|
||||||
seedCache.stashAlbum(album)
|
seedCache.stashAlbum(album)
|
||||||
onClick()
|
onClick()
|
||||||
@@ -56,7 +61,7 @@ fun AlbumCard(
|
|||||||
CoverTile(
|
CoverTile(
|
||||||
url = album.displayCoverUrl,
|
url = album.displayCoverUrl,
|
||||||
contentDescription = album.title,
|
contentDescription = album.title,
|
||||||
size = 144.dp,
|
size = artSize,
|
||||||
background = MaterialTheme.colorScheme.surfaceVariant,
|
background = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
fallback = {
|
fallback = {
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.composables.icons.lucide.Lucide
|
import com.composables.icons.lucide.Lucide
|
||||||
import com.composables.icons.lucide.User
|
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.
|
* circular play button is overlaid at the bottom-right of the avatar.
|
||||||
* Only Home wires it currently. Padding is 4dp instead of 6dp because
|
* Only Home wires it currently. Padding is 4dp instead of 6dp because
|
||||||
* the circular avatar pulls the button visually inward at the corner.
|
* 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
|
@Composable
|
||||||
fun ArtistCard(
|
fun ArtistCard(
|
||||||
@@ -42,11 +46,12 @@ fun ArtistCard(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onPlay: (suspend () -> Unit)? = null,
|
onPlay: (suspend () -> Unit)? = null,
|
||||||
|
artSize: Dp = 128.dp,
|
||||||
) {
|
) {
|
||||||
val seedCache = LocalDetailSeedCache.current
|
val seedCache = LocalDetailSeedCache.current
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.width(144.dp)
|
.width(artSize + 16.dp)
|
||||||
.clickable {
|
.clickable {
|
||||||
seedCache.stashArtist(artist)
|
seedCache.stashArtist(artist)
|
||||||
onClick()
|
onClick()
|
||||||
@@ -60,7 +65,7 @@ fun ArtistCard(
|
|||||||
CoverTile(
|
CoverTile(
|
||||||
url = artist.displayCoverUrl,
|
url = artist.displayCoverUrl,
|
||||||
contentDescription = artist.name,
|
contentDescription = artist.name,
|
||||||
size = 128.dp,
|
size = artSize,
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
fallback = {
|
fallback = {
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Shape
|
import androidx.compose.ui.graphics.Shape
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.fabledsword.minstrel.theme.FabledSwordFlatTokens
|
import com.fabledsword.minstrel.theme.FabledSwordFlatTokens
|
||||||
|
|
||||||
@@ -67,17 +68,17 @@ fun SkeletonBox(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stand-in for AlbumCard / PlaylistCard (same 176dp×144dp cover +
|
* Stand-in for AlbumCard / PlaylistCard (same geometry: an [artSize]
|
||||||
* 2 caption lines geometry).
|
* cover in a tile 32dp wider, and 2 caption lines).
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun SkeletonAlbumTile(modifier: Modifier = Modifier) {
|
fun SkeletonAlbumTile(modifier: Modifier = Modifier, artSize: Dp = 144.dp) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.width(176.dp)
|
.width(artSize + 32.dp)
|
||||||
.padding(horizontal = 8.dp),
|
.padding(horizontal = 8.dp),
|
||||||
) {
|
) {
|
||||||
SkeletonBox(modifier = Modifier.size(144.dp))
|
SkeletonBox(modifier = Modifier.size(artSize))
|
||||||
Spacer(Modifier.height(8.dp))
|
Spacer(Modifier.height(8.dp))
|
||||||
SkeletonBox(modifier = Modifier.fillMaxWidth().height(14.dp))
|
SkeletonBox(modifier = Modifier.fillMaxWidth().height(14.dp))
|
||||||
Spacer(Modifier.height(4.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
|
@Composable
|
||||||
fun SkeletonArtistTile(modifier: Modifier = Modifier) {
|
fun SkeletonArtistTile(modifier: Modifier = Modifier, artSize: Dp = 128.dp) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.width(144.dp)
|
.width(artSize + 16.dp)
|
||||||
.padding(horizontal = 8.dp),
|
.padding(horizontal = 8.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
SkeletonBox(
|
SkeletonBox(
|
||||||
modifier = Modifier.size(128.dp),
|
modifier = Modifier.size(artSize),
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(8.dp))
|
Spacer(Modifier.height(8.dp))
|
||||||
|
|||||||
Reference in New Issue
Block a user