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.

Make closing the player the opening reversed

Lelonioa93424a57a1d
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index 915f24c..0b28c9f 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -91,7 +91,8 @@
"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 *)",
"Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Let the page show through the player as it is dragged away *)",
- "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Contract the player as it collapses *)"
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Contract the player as it collapses *)",
+ "Bash(git -c user.name=Emanuele -c [email protected] commit -qm 'Make closing the player the opening reversed *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index 25a1f87..f8cc063 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/NowPlayingSheet.kt b/app/src/main/java/dev/emanuele/spot/ui/player/NowPlayingSheet.kt
index 7ad5b3f..cc25e90 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/NowPlayingSheet.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/NowPlayingSheet.kt
@@ -96,7 +96,10 @@ fun NowPlayingSheet(
val collapsedHeight = MiniPlayerHeight
val travelPx = with(density) { (fullHeight - collapsedHeight).toPx() }
- fun settle(target: Float) {
+ // One spec for both directions, and the same one the tap uses: closing
+ // is meant to be the opening played backwards, so nothing about the
+ // motion may depend on which way it is going.
+ fun settle(target: Float, initialVelocity: Float = 0f) {
scope.launch {
progress.animateTo(
target,
@@ -104,6 +107,7 @@ fun NowPlayingSheet(
// settle rather than stopping dead, which is what makes a
// panel this size feel like it has weight.
spring(dampingRatio = 0.86f, stiffness = Spring.StiffnessMediumLow),
+ initialVelocity = initialVelocity,
)
}
}
@@ -165,7 +169,11 @@ fun NowPlayingSheet(
progress.value > 0.5f -> 1f
else -> 0f
}
- settle(target)
+ // Handed to the spring rather than dropped. Releasing
+ // mid-drag otherwise restarted the motion from a dead
+ // stop, which is the one thing a tap-to-open never does
+ // and is why closing felt unlike opening reversed.
+ settle(target, initialVelocity = -velocity / travelPx)
},
),
) {
@@ -245,17 +253,23 @@ fun NowPlayingSheet(
}
/**
- * The bar is gone by a fifth of the way up, the player is there by two thirds.
+ * The bar is gone by a third of the way up, and the player starts there.
*
- * They deliberately do not cross at 0.5: with both half-visible in the middle
- * of the travel you see two sets of controls at once, which is precisely what
- * the cross-fade version looked like.
+ * They hand over rather than overlap: with both half-visible you see two sets
+ * of controls at once, which is what the cross-dissolve version looked like.
+ * They also hand over at exactly the same point in both directions — the two
+ * used to leave a sliver of travel where the bar had gone and the player had
+ * not arrived, and running that backwards is not the same as running it
+ * forwards.
*/
private fun collapsedAlpha(fraction: Float): Float =
- (1f - fraction / 0.2f).coerceIn(0f, 1f)
+ (1f - fraction / HANDOVER).coerceIn(0f, 1f)
private fun expandedAlpha(fraction: Float): Float =
- ((fraction - 0.15f) / 0.5f).coerceIn(0f, 1f)
+ ((fraction - HANDOVER) / (1f - HANDOVER) * 2f).coerceIn(0f, 1f)
+
+/** Where the bar has finished leaving and the player begins to arrive. */
+private const val HANDOVER = 0.3f
/**
* How far the player is shrunk when fully collapsed.