diff --git a/android/app/src/main/java/com/fabledsword/minstrel/player/ui/NowPlayingScreen.kt b/android/app/src/main/java/com/fabledsword/minstrel/player/ui/NowPlayingScreen.kt index d94c1c94..98d6e0a5 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/player/ui/NowPlayingScreen.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/player/ui/NowPlayingScreen.kt @@ -64,7 +64,6 @@ fun NowPlayingScreen( ) return } - Column( modifier = Modifier .fillMaxSize() @@ -72,48 +71,13 @@ fun NowPlayingScreen( verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally, ) { - Box( - modifier = Modifier - .widthIn(max = COVER_MAX_WIDTH_DP.dp) - .fillMaxWidth() - .aspectRatio(1f) - .clip(RoundedCornerShape(FabledSwordTokens.radiusLg)), - contentAlignment = Alignment.Center, - ) { - Icon( - imageVector = Lucide.Music, - contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, - modifier = Modifier.size(96.dp), - ) - } + CoverPlaceholder() Spacer(Modifier.height(24.dp)) - Text( - text = track.title, - style = MaterialTheme.typography.headlineMedium, - color = MaterialTheme.colorScheme.onBackground, - textAlign = TextAlign.Center, - maxLines = 2, - overflow = TextOverflow.Ellipsis, + TrackHeader( + title = track.title, + artist = track.artistName, + album = track.albumTitle, ) - Text( - text = track.artistName, - style = MaterialTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, - textAlign = TextAlign.Center, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - ) - if (track.albumTitle.isNotEmpty()) { - Text( - text = track.albumTitle, - style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, - textAlign = TextAlign.Center, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - ) - } Spacer(Modifier.height(24.dp)) ScrubberRow( positionMs = state.positionMs, @@ -130,6 +94,55 @@ fun NowPlayingScreen( } } +@Composable +private fun CoverPlaceholder() { + Box( + modifier = Modifier + .widthIn(max = COVER_MAX_WIDTH_DP.dp) + .fillMaxWidth() + .aspectRatio(1f) + .clip(RoundedCornerShape(FabledSwordTokens.radiusLg)), + contentAlignment = Alignment.Center, + ) { + Icon( + imageVector = Lucide.Music, + contentDescription = null, + tint = MaterialTheme.colorScheme.onSurfaceVariant, + modifier = Modifier.size(96.dp), + ) + } +} + +@Composable +private fun TrackHeader(title: String, artist: String, album: String) { + Text( + text = title, + style = MaterialTheme.typography.headlineMedium, + color = MaterialTheme.colorScheme.onBackground, + textAlign = TextAlign.Center, + maxLines = 2, + overflow = TextOverflow.Ellipsis, + ) + Text( + text = artist, + style = MaterialTheme.typography.titleMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + textAlign = TextAlign.Center, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + if (album.isNotEmpty()) { + Text( + text = album, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + textAlign = TextAlign.Center, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + } +} + @Composable private fun ScrubberRow(positionMs: Long, durationMs: Long, onSeek: (Long) -> Unit) { val accent = MaterialTheme.colorScheme.primary