Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.
Kotlin alternativeandroidandroid-applicationclientglassmorphisminnertubelibrespotliquid-glassspotifyspotify-connectspotifyapiyoutube-musicyoutube-playerytdlnis
Collapse the home header without recomposing the page
Lelonio7841ad747dff
diff --git a/.claude/settings.local.json b/.claude/settings.local.jsonindex 0788620..dea6ea0 100644--- a/.claude/settings.local.json+++ b/.claude/settings.local.json@@ -140,7 +140,8 @@"Bash(git commit -q -m 'The final icon artwork *)","Bash(./gradlew :app:compileDebugKotlin -q)","Bash(./gradlew :app:assembleDebug -q)",- "Bash(git commit -q -m ' *)"+ "Bash(git commit -q -m ' *)",+ "Bash(./gradlew :app:assembleRelease -q)"]}}diff --git a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.binindex 2036269..0fdd496 100644--- a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin+++ b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin@@ -2,27 +2,27 @@ C/C++ Structured Logca_/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/additional_project_files.txtCA-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint �嫉�3 ��߈�3`+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint �����3 ��߈�3`^-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json �嫉�3� ��߈�3e+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json �����3� ��߈�3ec-a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json �嫉�3� ��߈�3R+a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json �����3� ��߈�3RP-N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja �嫉�3� ��߈�3V+N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja �����3� ��߈�3VT-R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt �嫉�3[+R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt �����3[Y-W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt �嫉�3 @ ��߈�3\+W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt �����3 @ ��߈�3\Z-X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json �嫉�3֚ ��߈�3`+X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json �����3֚ ��߈�3`^-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin �嫉�3 �" ��߈�3f+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin �����3 �" ��߈�3fd-b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt �嫉�3+b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt �����3� ��߈�3YW-U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json �嫉�3 ( ��߈�3^+U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json �����3 ( ��߈�3^\-Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt �嫉�3 Y ��߈�3D+Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt �����3 Y ��߈�3DB-@/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 filediff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.binindex cf1587d..ef71470 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 Logljh/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/additional_project_files.txtCA-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint �����3 ����3i+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint ����3 ����3ig-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� ����3nl-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 ����3db-`/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 @ ����3ec-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�� ����3ig-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 �" ����3om-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 ( ����3ge-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 ����3DB-@/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 filediff --git a/app/src/main/java/dev/emanuele/spot/ui/home/HomeScreen.kt b/app/src/main/java/dev/emanuele/spot/ui/home/HomeScreen.ktindex 34bfac4..401cb58 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@@ -54,7 +54,8 @@ import dev.emanuele.spot.ui.components.AppIconimport dev.emanuele.spot.ui.components.AppLockupimport dev.emanuele.spot.ui.components.Artworkimport dev.emanuele.spot.ui.components.SquareWordmark-import androidx.compose.ui.draw.clipToBounds+import androidx.compose.ui.layout.layout+import androidx.compose.ui.unit.Constraintsimport dev.emanuele.spot.ui.glass.LiquidButtonimport dev.emanuele.spot.ui.player.GlassFilmimport dev.emanuele.spot.ui.theme.Ink@@ -187,7 +188,7 @@ fun HomeScreen(Header(name = state.displayName,avatarUrl = state.avatarUrl,- collapse = collapse,+ collapse = { collapse },filter = filter,highlighted = if (filter == Feed.ALL) visibleSection ?: Feed.ALL else filter,backdrop = backdrop,@@ -291,7 +292,17 @@ fun HomeScreen(private fun Header(name: String,avatarUrl: String?,- collapse: Float,+ /**+ * How far collapsed, as a lambda rather than a value.+ *+ * Deliberate, and the whole reason this scrolls smoothly: a `Float`+ * parameter is read when the header is composed, so every pixel of scroll+ * invalidated the composable that produced it — the home page, list content+ * lambdas included — several dozen times a second. Read inside `layout` and+ * `graphicsLayer` blocks instead, the same movement costs a measure pass and+ * no recomposition at all.+ */+ collapse: () -> Float,filter: Feed,/** The chip drawn as active, which follows the scroll while nothing is filtered. */highlighted: Feed,@@ -316,32 +327,42 @@ private fun Header(Row(Modifier.fillMaxWidth()- .padding(- start = 24.dp,- end = 24.dp,- top = lerp(18.dp, 2.dp, collapse),- ),+ .padding(start = 24.dp, end = 24.dp)+ // The top padding, as a layout pass: `padding()` takes a Dp,+ // which would have to be computed while composing.+ .layout { measurable, constraints ->+ val top = lerp(18.dp, 2.dp, collapse()).roundToPx()+ val placeable = measurable.measure(constraints)+ layout(placeable.width, placeable.height + top) {+ placeable.place(0, top)+ }+ },verticalAlignment = Alignment.CenterVertically,) {Column(Modifier.weight(1f)) {+ // The name and the icon, where the greeting used to be. The+ // home page carried nothing of the app on it — no name, no mark+ // — so the first screen after the launcher looked like it+ // belonged to nothing in particular.+ //// Height goes with the alpha. Fading it alone would leave the// header the same size with a blank line in it.- if (collapse < 1f) {- // The name and the icon, where the greeting used to be. The- // home page carried nothing of the app on it — no name, no- // mark — so the first screen after the launcher looked like- // it belonged to nothing in particular.- AppLockup(- iconSize = 18.dp,- nameHeight = 11.dp,- modifier = Modifier- .height(lerp(20.dp, 0.dp, collapse))- // The icon is taller than the row gets on the way- // out, and would otherwise spill over the name.- .clipToBounds()- .graphicsLayer { alpha = 1f - collapse },- )- }+ AppLockup(+ iconSize = 18.dp,+ nameHeight = 11.dp,+ modifier = Modifier+ .layout { measurable, constraints ->+ val placeable = measurable.measure(constraints)+ val height = lerp(LOCKUP_HEIGHT, 0.dp, collapse()).roundToPx()+ layout(placeable.width, height) { placeable.place(0, 0) }+ }+ // The icon is taller than the row gets on the way out,+ // and would otherwise spill over the name.+ .graphicsLayer {+ clip = true+ alpha = 1f - collapse()+ },+ )Text(name,style = MaterialTheme.typography.displayLarge,@@ -350,7 +371,7 @@ private fun Header(// Scaled rather than swapped for a smaller style: a style// change is a jump, and this has to track a finger.modifier = Modifier.graphicsLayer {- val scale = 1f - 0.34f * collapse+ val scale = 1f - 0.34f * collapse()scaleX = scalescaleY = scaletransformOrigin = TransformOrigin(0f, 0.5f)@@ -369,7 +390,13 @@ private fun Header(title = name,modifier = Modifier.padding(start = 14.dp)- .size(lerp(46.dp, 36.dp, collapse))+ // Measured from the scroll rather than sized in+ // composition; see the note on `collapse`.+ .layout { measurable, _ ->+ val side = lerp(46.dp, 36.dp, collapse()).roundToPx()+ val placeable = measurable.measure(Constraints.fixed(side, side))+ layout(side, side) { placeable.place(0, 0) }+ }.clip(CircleShape).clickable(onClick = onOpenSettings).softShadow(CircleShape, elevation = 10.dp),@@ -648,6 +675,9 @@ private val SelectedFilm = Color.White.copy(alpha = 0.26f)*/private const val COLLAPSE_DISTANCE_PX = 140f+/** The icon-and-name line above the account name, at rest. */+private val LOCKUP_HEIGHT = 20.dp+/** Comfortably under the 640px Spotify serves, so it is never upscaled. */private val COVER_SIZE = 210.dp