Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Rewrite the home page on the glass material

Lelonioec59ed25954d
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index 5276750..1c94116 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -58,7 +58,8 @@
"Bash(sed -n '/^fun.*LiquidBottomTab\\\\b/,/^\\) {/p' app/src/main/java/dev/emanuele/spot/ui/glass/LiquidBottomTab.kt)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Restore the bottom bar'\\\\''s colours after the file rebuild *)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Lay the bottom tabs out with LiquidBottomTab *)",
- "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Turn the home page into a feed *)"
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Turn the home page into a feed *)",
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Rewrite the home page on the glass material *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index d77276b..12efedb 100644
--- a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logl
j
h/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ����3i
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �����3� ����3n
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �����3� ����3n
l
-j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �����3� �����3[
+j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �����3� �����3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �����3�� ����3_
+W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �����3�� ����3_
]
-[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �����3d
+[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �����3d
b
-`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �����3 @ ����3e
+`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �����3 @ ����3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �����3�� ����3i
+a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �����3�� ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �����3 �" ����3o
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �����3 �" ����3o
m
-k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �����3
+k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �����3
� ����3b
`
-^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �����3  ( ����3g
+^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �����3  ( ����3g
e
-c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �����3  b ����3D
+c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �����3  b ����3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
index 73ebe10..40133a2 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
@@ -246,6 +246,7 @@ fun SpotApp(
viewModel.openContext(item.uri, item.title, item.artworkUrl)
navController.navigate(Routes.PLAYLIST)
},
+ backdrop = artBackdrop,
)
}
diff --git a/app/src/main/java/dev/emanuele/spot/ui/home/HomeScreen.kt b/app/src/main/java/dev/emanuele/spot/ui/home/HomeScreen.kt
index 660bf19..b66b3da 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/home/HomeScreen.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/home/HomeScreen.kt
@@ -19,12 +19,18 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.Button
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Pause
+import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material3.CircularProgressIndicator
+import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
-import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
@@ -33,15 +39,46 @@ 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 com.kyant.backdrop.Backdrop
+import com.kyant.shapes.Capsule
import dev.emanuele.spot.data.CatalogPlaylist
import dev.emanuele.spot.data.CatalogTrack
import dev.emanuele.spot.data.SearchItem
import dev.emanuele.spot.ui.MainViewModel
import dev.emanuele.spot.ui.components.Artwork
+import dev.emanuele.spot.ui.glass.LiquidButton
+import dev.emanuele.spot.ui.player.GlassFilm
+import dev.emanuele.spot.ui.player.GlassSurface
import dev.emanuele.spot.ui.player.PlaybackState
+import dev.emanuele.spot.ui.theme.Ink
+import dev.emanuele.spot.ui.theme.InkDim
import dev.emanuele.spot.ui.theme.softShadow
import java.util.Calendar
+/**
+ * What the feed is showing.
+ *
+ * A filter rather than tabs: the sections keep their order and the chips only
+ * decide which of them are on the page, so nothing moves around when you switch
+ * and "Tutto" is genuinely the whole thing rather than a fourth view.
+ */
+private enum class Feed(val label: String) {
+ ALL("Tutto"),
+ RELEASES("Novità"),
+ ARTISTS("Artisti"),
+ LIBRARY("Libreria"),
+}
+
+/**
+ * The home page.
+ *
+ * Rewritten from scratch rather than adjusted. The previous version had grown
+ * from a plain Material list — filled buttons, section headings, a progress
+ * spinner in the middle of the page — and adding glass cards on top of it left
+ * two design languages sharing a screen. Everything here is drawn on the same
+ * material as the bars and the player: no Material containers, no elevation, no
+ * accent-filled buttons.
+ */
@Composable
fun HomeScreen(
state: MainViewModel.UiState,
@@ -56,6 +93,8 @@ fun HomeScreen(
onPlayRecent: (List<CatalogTrack>, Int) -> Unit,
feed: MainViewModel.FeedState,
onOpenItem: (SearchItem) -> Unit,
+ /** The layer the glass on this page refracts; see the note in SpotApp. */
+ backdrop: Backdrop,
) {
when (state) {
MainViewModel.UiState.LoggedOut -> Centered {
@@ -63,210 +102,238 @@ fun HomeScreen(
Text(
"Client non ufficiale per account Premium",
style = MaterialTheme.typography.bodyMedium,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
+ color = InkDim,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 40.dp),
)
- Button(onClick = onLogIn, modifier = Modifier.padding(top = 14.dp)) {
- Text("Accedi con Spotify")
- }
+ GlassAction("Accedi con Spotify", backdrop, onLogIn)
}
MainViewModel.UiState.Connecting,
MainViewModel.UiState.Loading,
-> Centered {
- CircularProgressIndicator(
- color = MaterialTheme.colorScheme.primary,
- strokeWidth = 2.dp,
- )
+ CircularProgressIndicator(color = Ink, strokeWidth = 2.dp)
}
is MainViewModel.UiState.Failed -> Centered {
Text(
state.message,
style = MaterialTheme.typography.bodyMedium,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
+ color = InkDim,
+ textAlign = TextAlign.Center,
modifier = Modifier.padding(horizontal = 40.dp),
)
- Button(onClick = onRetry) { Text("Riprova") }
- TextButton(onClick = onLogOut) { Text("Esci") }
+ GlassAction("Riprova", backdrop, onRetry)
+ GlassAction("Esci", backdrop, onLogOut)
}
- is MainViewModel.UiState.Ready -> LazyColumn(
- Modifier.fillMaxSize(),
- contentPadding = contentPadding,
- ) {
- item(contentType = "greeting") {
- Column(Modifier.padding(start = 24.dp, end = 24.dp, top = 40.dp)) {
- Text(
- greeting().uppercase(),
- style = MaterialTheme.typography.labelLarge,
- color = MaterialTheme.colorScheme.primary,
- )
- Text(
- state.displayName,
- style = MaterialTheme.typography.displayLarge,
- modifier = Modifier.padding(top = 2.dp),
- )
- }
- }
+ is MainViewModel.UiState.Ready -> {
+ var filter by remember { mutableStateOf(Feed.ALL) }
+ val showReleases = filter == Feed.ALL || filter == Feed.RELEASES
+ val showArtists = filter == Feed.ALL || filter == Feed.ARTISTS
+ val showLibrary = filter == Feed.ALL || filter == Feed.LIBRARY
- if (playback.hasItem) {
- item(contentType = "resume") {
- ResumeCard(playback, onOpenPlayer)
+ LazyColumn(Modifier.fillMaxSize(), contentPadding = contentPadding) {
+ item(contentType = "greeting") {
+ Column(Modifier.padding(start = 24.dp, end = 24.dp, top = 34.dp)) {
+ Text(
+ greeting().uppercase(),
+ style = MaterialTheme.typography.labelLarge,
+ color = InkDim,
+ )
+ Text(
+ state.displayName,
+ style = MaterialTheme.typography.displayLarge,
+ modifier = Modifier.padding(top = 2.dp),
+ )
+ }
}
- }
- if (feed.newReleases.isNotEmpty()) {
- item(contentType = "section") {
- SectionTitle("Novità", Modifier.padding(top = 30.dp))
+ if (playback.hasItem) {
+ item(contentType = "resume") {
+ NowPlayingCard(playback, backdrop, onOpenPlayer)
+ }
}
- // Cards rather than another row of thumbnails, and only a few of
- // them. A carousel says "here is a list, pick one"; this section
- // is meant to be looked at, so each release gets the width of the
- // screen and the cover is allowed to carry it. Six, because a
- // feed that never ends turns the sections below it into
- // something nobody scrolls to.
- items(
- feed.newReleases.take(FEED_SIZE),
- key = { it.uri },
- contentType = { "feedCard" },
- ) { item ->
- FeedCard(item) { onOpenItem(item) }
+
+ item(contentType = "filters") {
+ FilterRow(filter, backdrop) { filter = it }
}
- }
- if (feed.topArtists.isNotEmpty()) {
- item(contentType = "section") {
- SectionTitle("Artisti che ascolti", Modifier.padding(top = 34.dp))
+ if (showReleases && feed.newReleases.isNotEmpty()) {
+ item(contentType = "heading") { Heading("Novità") }
+ // Cards rather than another row of thumbnails. A carousel
+ // says "here is a list, pick one"; this is meant to be
+ // looked at, so each release gets the width of the page and
+ // the cover carries it.
+ items(
+ feed.newReleases.take(FEED_SIZE),
+ key = { it.uri },
+ contentType = { "card" },
+ ) { item ->
+ FeedCard(item, backdrop) { onOpenItem(item) }
+ }
}
- item(contentType = "artists") {
- LazyRow(
- contentPadding = PaddingValues(horizontal = 24.dp),
- horizontalArrangement = Arrangement.spacedBy(14.dp),
- modifier = Modifier.padding(top = 14.dp),
- ) {
- items(feed.topArtists, key = { it.uri }) { artist ->
+
+ if (showArtists && feed.topArtists.isNotEmpty()) {
+ item(contentType = "heading") { Heading("Artisti che ascolti") }
+ item(contentType = "artists") {
+ Carousel(feed.topArtists, key = { it.uri }) { artist ->
ArtistTile(artist) { onOpenItem(artist) }
}
}
}
- }
-
- item(contentType = "section") {
- SectionTitle("Le tue playlist", Modifier.padding(top = 30.dp))
- }
- item(contentType = "carousel") {
- LazyRow(
- contentPadding = PaddingValues(horizontal = 24.dp),
- horizontalArrangement = Arrangement.spacedBy(14.dp),
- modifier = Modifier.padding(top = 14.dp),
- ) {
- items(state.playlists.take(CAROUSEL_SIZE), key = { it.uri }) { playlist ->
- PlaylistTile(playlist) { onOpenPlaylist(playlist) }
+ if (showLibrary || filter == Feed.ALL) {
+ item(contentType = "heading") { Heading("Le tue playlist") }
+ item(contentType = "playlists") {
+ Carousel(
+ state.playlists.take(if (showLibrary) LIBRARY_SIZE else CAROUSEL_SIZE),
+ key = { it.uri },
+ ) { playlist ->
+ PlaylistTile(playlist) { onOpenPlaylist(playlist) }
+ }
}
}
- }
- if (recent.isNotEmpty()) {
- item(contentType = "section") {
- SectionTitle("Riascolta", Modifier.padding(top = 34.dp))
- }
- item(contentType = "recent") {
- LazyRow(
- contentPadding = PaddingValues(horizontal = 24.dp),
- horizontalArrangement = Arrangement.spacedBy(14.dp),
- modifier = Modifier.padding(top = 14.dp),
- ) {
- itemsIndexed(recent, key = { _, track -> track.uri }) { index, track ->
- TrackTile(track) { onPlayRecent(recent, index) }
+ if (recent.isNotEmpty() && filter != Feed.ARTISTS) {
+ item(contentType = "heading") { Heading("Riascolta") }
+ item(contentType = "recent") {
+ LazyRow(
+ contentPadding = PaddingValues(horizontal = 20.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ modifier = Modifier.padding(top = 14.dp),
+ ) {
+ itemsIndexed(recent, key = { _, track -> track.uri }) { index, track ->
+ TrackTile(track) { onPlayRecent(recent, index) }
+ }
}
}
}
- }
- item(contentType = "section") {
- SectionTitle("Il resto della libreria", Modifier.padding(top = 34.dp))
- }
-
- // A deliberately short list rather than all 62: the home page is for
- // getting somewhere quickly, and the library tab already holds the
- // full set.
- items(
- state.playlists.drop(CAROUSEL_SIZE).take(REST_SIZE),
- key = { it.uri },
- contentType = { "row" },
- ) { playlist ->
- CompactRow(playlist) { onOpenPlaylist(playlist) }
+ item(contentType = "tail") { Box(Modifier.height(24.dp)) }
}
}
}
}
+/**
+ * The playing track, as a pane of glass.
+ *
+ * The one card on the page that is not a cover: it sits over the app's blurred
+ * artwork, which *is* this track's cover, so filling it with the same image
+ * again would be a picture of itself.
+ */
@Composable
-private fun ResumeCard(playback: PlaybackState, onClick: () -> Unit) {
- Row(
- Modifier
- .padding(start = 24.dp, end = 24.dp, top = 26.dp)
+private fun NowPlayingCard(playback: PlaybackState, backdrop: Backdrop, onClick: () -> Unit) {
+ val shape = RoundedCornerShape(26.dp)
+ GlassSurface(
+ backdrop = backdrop,
+ shape = shape,
+ surfaceColor = GlassFilm,
+ modifier = Modifier
+ .padding(horizontal = 20.dp)
+ .padding(top = 22.dp)
.fillMaxWidth()
- .clip(RoundedCornerShape(20.dp))
- .clickable(onClick = onClick)
- .padding(4.dp),
- verticalAlignment = Alignment.CenterVertically,
+ .clip(shape)
+ .clickable(onClick = onClick),
) {
- Artwork(
- url = playback.artworkUrl,
- title = playback.title,
- modifier = Modifier.size(74.dp),
- corner = 16.dp,
- decodeSize = 74.dp,
- )
- Column(
- Modifier
- .padding(start = 16.dp)
- .weight(1f),
+ Row(
+ Modifier.padding(14.dp),
+ verticalAlignment = Alignment.CenterVertically,
) {
- Text(
- if (playback.isPlaying) "IN RIPRODUZIONE" else "IN PAUSA",
- style = MaterialTheme.typography.labelLarge,
- color = MaterialTheme.colorScheme.primary,
- )
- Text(
- playback.title,
- style = MaterialTheme.typography.titleLarge,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier.padding(top = 4.dp),
+ Artwork(
+ url = playback.artworkUrl,
+ title = playback.title,
+ modifier = Modifier
+ .size(66.dp)
+ .softShadow(RoundedCornerShape(16.dp), elevation = 14.dp),
+ corner = 16.dp,
+ decodeSize = 66.dp,
)
- Text(
- playback.artist,
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis,
+ Column(
+ Modifier
+ .padding(start = 14.dp)
+ .weight(1f),
+ ) {
+ Text(
+ if (playback.isPlaying) "IN RIPRODUZIONE" else "IN PAUSA",
+ style = MaterialTheme.typography.labelLarge,
+ color = InkDim,
+ )
+ Text(
+ playback.title,
+ style = MaterialTheme.typography.titleLarge,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(top = 3.dp),
+ )
+ Text(
+ playback.artist,
+ style = MaterialTheme.typography.bodySmall,
+ color = InkDim,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ Icon(
+ if (playback.isPlaying) Icons.Filled.Pause else Icons.Filled.PlayArrow,
+ contentDescription = null,
+ tint = Ink,
+ modifier = Modifier
+ .padding(end = 6.dp)
+ .size(26.dp),
)
}
}
}
+@Composable
+private fun FilterRow(selected: Feed, backdrop: Backdrop, onSelect: (Feed) -> Unit) {
+ LazyRow(
+ contentPadding = PaddingValues(horizontal = 20.dp),
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ modifier = Modifier.padding(top = 22.dp),
+ ) {
+ items(Feed.entries.toList(), key = { it.name }) { entry ->
+ val isSelected = entry == selected
+ LiquidButton(
+ onClick = { onSelect(entry) },
+ backdrop = backdrop,
+ contentHeight = 38.dp,
+ contentPadding = 18.dp,
+ blurRadius = 8.dp,
+ // The selected chip is the same glass, filled a little harder.
+ // A tinted fill would put the artwork's colour on a control
+ // whose whole job is to be legible over any artwork.
+ surfaceColor = if (isSelected) SelectedFilm else GlassFilm,
+ ) {
+ Text(
+ entry.label,
+ style = MaterialTheme.typography.bodyMedium,
+ color = if (isSelected) Ink else InkDim,
+ )
+ }
+ }
+ }
+}
+
/**
* One release, the full width of the page.
*
- * The title sits *on* the cover rather than under it. Every other listing in
- * this app puts a caption beneath a square, which is right when you are
- * scanning a row of twenty; here there are six, and the point is that each one
- * is worth stopping on. The gradient exists because covers are not designed to
- * have text over them — without it the title lands on whatever the artwork
- * happens to be doing in that corner.
+ * The caption sits in a pane of glass over the cover rather than under it, the
+ * way the bars over the rest of the app do. Text straight on artwork needs a
+ * gradient to survive a light cover, and a gradient large enough to do that
+ * ends up dimming the picture it is supposed to be showing.
*/
@Composable
-private fun FeedCard(item: SearchItem, onClick: () -> Unit) {
- val shape = RoundedCornerShape(26.dp)
+private fun FeedCard(item: SearchItem, backdrop: Backdrop, onClick: () -> Unit) {
+ val shape = RoundedCornerShape(28.dp)
Box(
Modifier
- .padding(horizontal = 20.dp, vertical = 8.dp)
+ .padding(horizontal = 20.dp, vertical = 7.dp)
.fillMaxWidth()
- .height(300.dp)
- .softShadow(shape, elevation = 20.dp, spot = 0.22f)
+ .height(320.dp)
+ .softShadow(shape, elevation = 22.dp, spot = 0.24f)
.clip(shape)
.clickable(onClick = onClick),
) {
@@ -277,39 +344,49 @@ private fun FeedCard(item: SearchItem, onClick: () -> Unit) {
corner = 0.dp,
)
+ // Just enough to seat the pane; the pane itself carries the contrast.
Box(
Modifier
.fillMaxSize()
.background(
Brush.verticalGradient(
0f to Color.Transparent,
- 0.45f to Color.Black.copy(alpha = 0.25f),
- 1f to Color.Black.copy(alpha = 0.80f),
+ 1f to Color.Black.copy(alpha = 0.35f),
),
),
)
- Column(
- Modifier
- .align(Alignment.BottomStart)
- .padding(20.dp),
+ GlassSurface(
+ backdrop = backdrop,
+ shape = Capsule(),
+ surfaceColor = GlassFilm,
+ modifier = Modifier
+ .align(Alignment.BottomCenter)
+ .padding(14.dp)
+ .fillMaxWidth(),
) {
- Text(
- item.title,
- style = MaterialTheme.typography.headlineLarge,
- color = Color.White,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis,
- )
- if (item.subtitle.isNotBlank()) {
- Text(
- item.subtitle,
- style = MaterialTheme.typography.bodyMedium,
- color = Color.White.copy(alpha = 0.75f),
- maxLines = 1,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier.padding(top = 2.dp),
- )
+ Row(
+ Modifier.padding(horizontal = 18.dp, vertical = 12.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(Modifier.weight(1f)) {
+ Text(
+ item.title,
+ style = MaterialTheme.typography.titleLarge,
+ color = Ink,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ if (item.subtitle.isNotBlank()) {
+ Text(
+ item.subtitle,
+ style = MaterialTheme.typography.bodySmall,
+ color = InkDim,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ }
}
}
}
@@ -320,7 +397,7 @@ private fun FeedCard(item: SearchItem, onClick: () -> Unit) {
private fun ArtistTile(artist: SearchItem, onClick: () -> Unit) {
Column(
Modifier
- .width(112.dp)
+ .width(110.dp)
.clickable(onClick = onClick),
horizontalAlignment = Alignment.CenterHorizontally,
) {
@@ -328,10 +405,10 @@ private fun ArtistTile(artist: SearchItem, onClick: () -> Unit) {
url = artist.artworkUrl,
title = artist.title,
modifier = Modifier
- .size(112.dp)
- .softShadow(CircleShape, elevation = 12.dp),
- corner = 56.dp,
- decodeSize = 112.dp,
+ .size(110.dp)
+ .softShadow(CircleShape, elevation = 14.dp),
+ corner = 55.dp,
+ decodeSize = 110.dp,
)
Text(
artist.title,
@@ -345,103 +422,105 @@ private fun ArtistTile(artist: SearchItem, onClick: () -> Unit) {
}
@Composable
-private fun TrackTile(track: CatalogTrack, onClick: () -> Unit) {
+private fun PlaylistTile(playlist: CatalogPlaylist, onClick: () -> Unit) {
Column(
- // No clip on the column: it would cut off the artwork's drop shadow,
- // which spreads wider than the tile itself.
Modifier
- .width(132.dp)
+ .width(152.dp)
.clickable(onClick = onClick),
) {
Artwork(
- url = track.artworkUrl,
- title = track.name,
+ url = playlist.artworkUrl,
+ title = playlist.name,
modifier = Modifier
- .size(132.dp)
- .softShadow(RoundedCornerShape(16.dp), elevation = 14.dp),
- corner = 16.dp,
- decodeSize = 132.dp,
+ .size(152.dp)
+ .softShadow(RoundedCornerShape(20.dp), elevation = 18.dp),
+ corner = 20.dp,
)
Text(
- track.name,
+ playlist.name,
style = MaterialTheme.typography.titleMedium,
- maxLines = 1,
+ maxLines = 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(top = 10.dp, start = 2.dp, end = 2.dp),
)
- Text(
- track.artist,
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier.padding(start = 2.dp, end = 2.dp),
- )
}
}
@Composable
-private fun PlaylistTile(playlist: CatalogPlaylist, onClick: () -> Unit) {
+private fun TrackTile(track: CatalogTrack, onClick: () -> Unit) {
Column(
+ // No clip on the column: it would cut off the artwork's drop shadow,
+ // which spreads wider than the tile itself.
Modifier
- .width(150.dp)
+ .width(128.dp)
.clickable(onClick = onClick),
) {
Artwork(
- url = playlist.artworkUrl,
- title = playlist.name,
+ url = track.artworkUrl,
+ title = track.name,
modifier = Modifier
- .size(150.dp)
- .softShadow(RoundedCornerShape(18.dp), elevation = 16.dp),
+ .size(128.dp)
+ .softShadow(RoundedCornerShape(18.dp), elevation = 14.dp),
corner = 18.dp,
+ decodeSize = 128.dp,
)
Text(
- playlist.name,
+ track.name,
style = MaterialTheme.typography.titleMedium,
- maxLines = 2,
+ maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(top = 10.dp, start = 2.dp, end = 2.dp),
)
+ Text(
+ track.artist,
+ style = MaterialTheme.typography.bodySmall,
+ color = InkDim,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(start = 2.dp, end = 2.dp),
+ )
}
}
@Composable
-private fun CompactRow(playlist: CatalogPlaylist, onClick: () -> Unit) {
- Row(
- Modifier
- .fillMaxWidth()
- .clickable(onClick = onClick)
- .padding(horizontal = 24.dp, vertical = 8.dp),
- verticalAlignment = Alignment.CenterVertically,
+private fun <T> Carousel(
+ items: List<T>,
+ key: (T) -> Any,
+ item: @Composable (T) -> Unit,
+) {
+ LazyRow(
+ contentPadding = PaddingValues(horizontal = 20.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ modifier = Modifier.padding(top = 14.dp),
) {
- Artwork(
- url = playlist.artworkUrl,
- title = playlist.name,
- modifier = Modifier.size(46.dp),
- corner = 12.dp,
- decodeSize = 46.dp,
- )
- Text(
- playlist.name,
- style = MaterialTheme.typography.titleMedium,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis,
- modifier = Modifier
- .padding(start = 16.dp)
- .weight(1f),
- )
+ items(items, key = key) { item(it) }
}
}
@Composable
-private fun SectionTitle(text: String, modifier: Modifier = Modifier) {
+private fun Heading(text: String) {
Text(
text,
style = MaterialTheme.typography.headlineLarge,
- modifier = modifier.padding(horizontal = 24.dp),
+ modifier = Modifier.padding(start = 24.dp, end = 24.dp, top = 30.dp),
)
}
+/** A glass pill, for the handful of places that need a button at all. */
+@Composable
+private fun GlassAction(label: String, backdrop: Backdrop, onClick: () -> Unit) {
+ LiquidButton(
+ onClick = onClick,
+ backdrop = backdrop,
+ contentHeight = 50.dp,
+ contentPadding = 26.dp,
+ blurRadius = 8.dp,
+ surfaceColor = GlassFilm,
+ ) {
+ Text(label, style = MaterialTheme.typography.titleMedium, color = Ink)
+ }
+}
+
@Composable
private fun Centered(content: @Composable () -> Unit) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
@@ -458,6 +537,11 @@ private fun greeting(): String = when (Calendar.getInstance().get(Calendar.HOUR_
else -> "Buonasera"
}
+/** A harder film for the chip that is on; see the note at the call site. */
+private val SelectedFilm = Color.White.copy(alpha = 0.26f)
+
private const val FEED_SIZE = 6
private const val CAROUSEL_SIZE = 8
-private const val REST_SIZE = 6
+
+/** With the library filter on, the carousel is the whole point of the page. */
+private const val LIBRARY_SIZE = 30