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.

Contract the player as it collapses

Lelonio298e6c22b2d1
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index d010275..915f24c 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -90,7 +90,8 @@
"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 '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 '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 *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index 3de6e85..25a1f87 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 46cb02a..7ad5b3f 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
@@ -22,6 +22,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.CompositingStrategy
+import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalDensity
@@ -196,7 +197,21 @@ fun NowPlayingSheet(
.height(fullHeight)
.fillMaxWidth()
.graphicsLayer {
- alpha = expandedAlpha(progress.value)
+ val f = progress.value.coerceIn(0f, 1f)
+ alpha = expandedAlpha(f)
+ // Contracts towards the bottom edge as it closes.
+ //
+ // Without this the player was a full-size screen
+ // being slid down behind a shrinking window: every
+ // element kept its size right up to the moment it
+ // was gone, which reads as a screen leaving rather
+ // than as a panel collapsing into the bar. The
+ // origin is the bottom because that is where the bar
+ // it is becoming actually is.
+ val scale = COLLAPSE_SCALE + (1f - COLLAPSE_SCALE) * f
+ scaleX = scale
+ scaleY = scale
+ transformOrigin = TransformOrigin(0.5f, 1f)
// Modulated rather than composited: the default
// draws the whole subtree into an offscreen buffer
// the size of the window before applying alpha,
@@ -242,6 +257,14 @@ private fun collapsedAlpha(fraction: Float): Float =
private fun expandedAlpha(fraction: Float): Float =
((fraction - 0.15f) / 0.5f).coerceIn(0f, 1f)
+/**
+ * How far the player is shrunk when fully collapsed.
+ *
+ * Enough to read as a contraction; much below this and the text inside starts
+ * to look like it is being squashed rather than moving away.
+ */
+private const val COLLAPSE_SCALE = 0.86f
+
/** Margin the collapsed bar keeps from the edges of the window. */
private val SIDE_MARGIN = 16.dp