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.

Morph the now-playing bar into the player's title capsule

Leloniocfb789753c80
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index 9c7c4ea..1c5e960 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -65,7 +65,16 @@
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Lyrics centre stage over a blurred Canvas; fix the card blur artefact *)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Word-level lyric highlight, list fade, chips follow the scroll *)",
"Bash(cd \"/Users/emanuele/Progetto Spotify\" && grep -rn \"sharedElement\\\\|SharedTransitionLayout\" ~/.gradle/caches/modules-2/files-2.1/androidx.compose.animation/ 2>/dev/null | head -2; ls ~/.gradle/caches/modules-2/files-2.1/androidx.compose.animation/ 2>/dev/null)",
- "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Expand the mini player into the player; smooth the lyric sweep *)"
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Expand the mini player into the player; smooth the lyric sweep *)",
+ "Bash(which ffmpeg *)",
+ "Bash(rm -f f_*.jpg)",
+ "Bash(ffmpeg -hide_banner -loglevel error -i \"/Users/emanuele/Desktop/screen-20260804-122239.mp4\" -vf \"fps=8,scale=360:-1\" -q:v 6 f_%03d.jpg)",
+ "Bash(ffprobe -v error -show_entries format=duration -of csv=p=0 \"/Users/emanuele/Desktop/screen-20260804-122239.mp4\")",
+ "Bash(ffmpeg -hide_banner -loglevel error -i f_%03d.jpg -vf \"select='between\\(n,20,43\\)',tile=6x4\" -frames:v 1 grid1.jpg)",
+ "Bash(ffmpeg -hide_banner -loglevel error -i f_%03d.jpg -vf \"select='between\\(n,44,67\\)',tile=6x4\" -frames:v 1 grid2.jpg)",
+ "Bash(unzip -o -q classes.jar 'androidx/compose/animation/SharedTransitionScope$ResizeMode$Companion.class')",
+ "Bash(javap -classpath . 'androidx.compose.animation.SharedTransitionScope$ResizeMode$Companion')",
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Morph the now-playing bar into the player'\\\\''s title capsule *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index c078429..3a5a920 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 07e7be7..0880ae9 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
@@ -6,6 +6,8 @@ import androidx.compose.animation.SharedTransitionLayout
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
+import androidx.compose.animation.scaleIn
+import androidx.compose.animation.scaleOut
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
@@ -50,6 +52,7 @@ import androidx.compose.ui.draw.blur
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.font.FontWeight
@@ -82,8 +85,10 @@ import dev.emanuele.spot.ui.glass.LiquidButton
import dev.emanuele.spot.ui.home.HomeScreen
import dev.emanuele.spot.ui.library.LibraryScreen
import dev.emanuele.spot.ui.library.PlaylistScreen
+import dev.emanuele.spot.ui.player.EXPAND_MS
import dev.emanuele.spot.ui.player.MiniPlayer
import dev.emanuele.spot.ui.player.GlassFilm
+import dev.emanuele.spot.ui.player.EXPAND_MS
import dev.emanuele.spot.ui.player.MiniPlayerHeight
import dev.emanuele.spot.ui.player.PlayerScreen
import dev.emanuele.spot.ui.player.progressOf
@@ -105,9 +110,6 @@ object Routes {
private val BottomBarHeight = 62.dp
-/** How long the mini player takes to become the player, and back. */
-private const val EXPAND_MS = 420
-
@OptIn(ExperimentalSharedTransitionApi::class)
@UnstableApi
@Composable
@@ -337,10 +339,38 @@ fun SpotApp(
// from the mini player's 42dp thumbnail to the full
// cover and back. Sliding the screen as well would
// be two animations describing the same thing.
- enterTransition = { fadeIn(tween(EXPAND_MS)) },
- exitTransition = { fadeOut(tween(EXPAND_MS)) },
- popEnterTransition = { fadeIn(tween(EXPAND_MS)) },
- popExitTransition = { fadeOut(tween(EXPAND_MS)) },
+ enterTransition = {
+ fadeIn(tween(220, delayMillis = 60)) +
+ scaleIn(
+ tween(EXPAND_MS),
+ initialScale = 0.94f,
+ transformOrigin = TransformOrigin(0.5f, 1f),
+ )
+ },
+ exitTransition = {
+ fadeOut(tween(160)) +
+ scaleOut(
+ tween(EXPAND_MS),
+ targetScale = 0.94f,
+ transformOrigin = TransformOrigin(0.5f, 1f),
+ )
+ },
+ popEnterTransition = {
+ fadeIn(tween(220, delayMillis = 60)) +
+ scaleIn(
+ tween(EXPAND_MS),
+ initialScale = 0.94f,
+ transformOrigin = TransformOrigin(0.5f, 1f),
+ )
+ },
+ popExitTransition = {
+ fadeOut(tween(160)) +
+ scaleOut(
+ tween(EXPAND_MS),
+ targetScale = 0.94f,
+ transformOrigin = TransformOrigin(0.5f, 1f),
+ )
+ },
) {
PlayerScreen(
state = playback,
@@ -412,8 +442,12 @@ fun SpotApp(
// the half of the transition that shrinks back into the bar.
AnimatedVisibility(
visible = !onPlayer && playback.hasItem,
- enter = fadeIn(tween(EXPAND_MS)),
- exit = fadeOut(tween(EXPAND_MS)),
+ // Short, because the bar does not really disappear: its
+ // bounds morph into the player's title capsule. A long
+ // fade here left a ghost of the bar sitting over the
+ // screen it had just become.
+ enter = fadeIn(tween(200, delayMillis = 120)),
+ exit = fadeOut(tween(120)),
) {
MiniPlayer(
state = playback,
diff --git a/app/src/main/java/dev/emanuele/spot/ui/player/MiniPlayer.kt b/app/src/main/java/dev/emanuele/spot/ui/player/MiniPlayer.kt
index 6bf23a0..cd0e8d6 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/MiniPlayer.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/MiniPlayer.kt
@@ -1,6 +1,7 @@
package dev.emanuele.spot.ui.player
import androidx.compose.animation.AnimatedContent
+import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.Crossfade
import androidx.compose.animation.core.tween
@@ -48,6 +49,7 @@ import dev.emanuele.spot.ui.theme.softShadow
* An extension rather than an inline block because it is needed identically at
* both ends, and the two have to agree on the key or nothing is shared.
*/
+@OptIn(ExperimentalSharedTransitionApi::class)
@Composable
fun Modifier.sharedArtwork(
sharedScope: androidx.compose.animation.SharedTransitionScope?,
@@ -62,8 +64,46 @@ fun Modifier.sharedArtwork(
}
}
-/** The key both ends of the expand animation agree on. */
+/**
+ * Morphs the now-playing bar into the player's title capsule.
+ *
+ * The artwork alone was not enough: a track with a Canvas has no cover on the
+ * player screen, so there was nothing for the thumbnail to become and the whole
+ * thing collapsed into a cross-dissolve of two full screens. These two panes,
+ * though, always both exist — a rounded glass pill carrying the title and the
+ * artist at each end — so the bar has something to grow into on every track.
+ */
+@OptIn(ExperimentalSharedTransitionApi::class)
+@Composable
+fun Modifier.sharedPill(
+ sharedScope: androidx.compose.animation.SharedTransitionScope?,
+ animatedScope: androidx.compose.animation.AnimatedVisibilityScope?,
+): Modifier {
+ if (sharedScope == null || animatedScope == null) return this
+ return with(sharedScope) {
+ rememberSharedContentState(key = SHARED_PILL),
+ animatedScope,
+ // The contents differ at the two ends — the bar has transport
+ // buttons, the capsule has the queue and like actions — so they
+ // cross-fade inside bounds that are morphing.
+ enter = fadeIn(tween(EXPAND_MS)),
+ exit = fadeOut(tween(EXPAND_MS / 2)),
+ // Scaled rather than remeasured: the two panes hold different
+ // controls, and re-laying them out mid-flight makes the contents
+ // jump around inside bounds that are already moving.
+ resizeMode = androidx.compose.animation.SharedTransitionScope
+ .ResizeMode.Companion.scaleToBounds(),
+ )
+ }
+}
+
+/** The keys both ends of the expand animation agree on. */
const val SHARED_ARTWORK = "nowPlayingArtwork"
+const val SHARED_PILL = "nowPlayingPill"
+
+/** Length of the expand, shared by both halves so they move together. */
+const val EXPAND_MS = 400
@Composable
fun MiniPlayer(
@@ -103,6 +143,7 @@ fun MiniPlayer(
surfaceColor = GlassFilm,
modifier = Modifier
.padding(horizontal = 12.dp)
+ .sharedPill(sharedScope, animatedScope)
.softShadow(shape, elevation = 20.dp, spot = 0.26f),
) {
Column(Modifier.clickable(onClick = onExpand)) {
diff --git a/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt
index 4f56476..fe85b1e 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt
@@ -280,7 +280,9 @@ fun PlayerScreen(
backdrop = glassBackdrop,
surfaceColor = GlassFilm,
shape = RoundedCornerShape(50),
- modifier = Modifier.fillMaxWidth(),
+ modifier = Modifier
+ .fillMaxWidth()
+ .sharedPill(sharedScope, animatedScope),
) {
Row(
Modifier.padding(start = 22.dp, end = 10.dp, top = 12.dp, bottom = 12.dp),