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.

Cross-fade the player's middle slot

Leloniobeaaf9638ea8
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index a621ede..37826af 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -88,7 +88,8 @@
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Cut the cost of expanding the player *)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Blur the page backdrop at decode time *)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Reorder the home sections *)",
- "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Raise the volume of a track created after playback started *)"
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Raise the volume of a track created after playback started *)",
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Cross-fade the player'\\\\''s middle slot *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index cdca646..b2bb8bc 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/player/PlayerScreen.kt b/app/src/main/java/dev/emanuele/spot/ui/player/PlayerScreen.kt
index 287988a..a8b7c7b 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
@@ -91,6 +91,9 @@ import dev.emanuele.spot.ui.theme.softShadow
* nothing to refract and looks like grey panels, which is why the artwork comes
* back here as a full-bleed backdrop.
*/
+/** What occupies the middle of the player. */
+private enum class Stage { COVER, LYRICS, CANVAS }
+
@UnstableApi
@Composable
fun PlayerScreen(
@@ -252,32 +255,54 @@ fun PlayerScreen(
// `weight(1f)`, not `weight(1f, fill = false)`: with the
// column arranged from the bottom, "as much space as it
// wants" is nothing once the controls have taken theirs.
- AnimatedVisibility(
- visible = canvas == null && !lyricsOpen,
- enter = fadeIn(tween(400)) + scaleIn(tween(400), initialScale = 0.92f),
- exit = fadeOut(tween(250)) + scaleOut(tween(250), targetScale = 0.92f),
+ // One slot, cross-faded, rather than two AnimatedVisibility
+ // blocks taking turns.
+ //
+ // Both of those carried a weight, so while one was
+ // leaving and the other arriving the column briefly had
+ // two weighted children and split the space between
+ // them — the cover shrank sideways as it left instead of
+ // simply going. A plain fade is what opening a lyric
+ // sheet should look like, and holding the slot open
+ // keeps everything below it still.
+ Crossfade(
+ targetState = when {
+ lyricsOpen -> Stage.LYRICS
+ canvas == null -> Stage.COVER
+ else -> Stage.CANVAS
+ },
+ animationSpec = tween(320),
+ label = "stage",
modifier = Modifier.weight(1f),
- ) {
- Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
- Cover(state, panel, onNext, onPrevious, sharedScope, animatedScope)
- }
- }
+ ) { stage ->
+ when (stage) {
+ Stage.COVER -> Box(
+ Modifier.fillMaxSize(),
+ contentAlignment = Alignment.Center,
+ ) {
+ Cover(
+ state,
+ panel,
+ onNext,
+ onPrevious,
+ sharedScope,
+ animatedScope,
+ )
+ }
- // The lyrics get the same space, whether or not there is
- // a Canvas behind them.
- AnimatedVisibility(
- visible = lyricsOpen,
- enter = fadeIn(tween(400)),
- exit = fadeOut(tween(220)),
- modifier = Modifier.weight(1f),
- ) {
- LyricsStage(
- lyrics = lyrics,
- loading = lyricsLoading,
- positionMs = positionMs,
- isPlaying = state.isPlaying,
- onSeek = onSeek,
- )
+ Stage.LYRICS -> LyricsStage(
+ lyrics = lyrics,
+ loading = lyricsLoading,
+ positionMs = positionMs,
+ isPlaying = state.isPlaying,
+ onSeek = onSeek,
+ )
+
+ // The clip is the picture, and it is drawn
+ // behind everything: this slot only has to keep
+ // the space.
+ Stage.CANVAS -> Box(Modifier.fillMaxSize())
+ }
}
Spacer(Modifier.height(20.dp))