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.

Deliver the notification intent; blur what the sheets actually cover

Lelonioabbc2deb46d1
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index c06340e..163b99d 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -122,7 +122,8 @@
"Bash(git commit -q -m 'A modal track sheet, and reverb that stops with playback *)",
"Bash(git commit -q -m 'Blur the sheet harder than the page; stop reverb on pause *)",
"Bash(git commit -q -m 'Reverb released on pause, notification opens the player, no black Canvas *)",
- "Bash(git commit -q -m 'Wait for a track before opening the player; drop the cover stand-in *)"
+ "Bash(git commit -q -m 'Wait for a track before opening the player; drop the cover stand-in *)",
+ "Bash(git commit -q -m 'Deliver the notification intent; blur what the sheets actually cover *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index 7830d1e..1cfdb75 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/playback/PlaybackService.kt b/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
index 5a96430..3744c50 100644
--- a/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
+++ b/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
@@ -33,6 +33,9 @@ import kotlinx.coroutines.withContext
/** Set on the intent the notification fires: open straight into the player. */
const val EXTRA_OPEN_PLAYER = "dev.emanuele.spot.OPEN_PLAYER"
+/** Its action; see the note where the PendingIntent is built. */
+const val ACTION_OPEN_PLAYER = "dev.emanuele.spot.action.OPEN_PLAYER"
+
class PlaybackService : MediaSessionService() {
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
@@ -73,11 +76,15 @@ class PlaybackService : MediaSessionService() {
android.app.PendingIntent.getActivity(
this,
0,
+ // Deliberately not ACTION_MAIN/CATEGORY_LAUNCHER. A launcher
+ // intent aimed at a singleTask activity that is already
+ // running is treated as "bring the task forward" and the
+ // intent is never delivered — the app came up on whatever
+ // screen it was last on and onNewIntent never fired. A
+ // custom action is delivered.
android.content.Intent(this, dev.emanuele.spot.ui.MainActivity::class.java)
- .setAction(android.content.Intent.ACTION_MAIN)
- .addCategory(android.content.Intent.CATEGORY_LAUNCHER)
- .putExtra(EXTRA_OPEN_PLAYER, true)
- .addFlags(android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP),
+ .setAction(ACTION_OPEN_PLAYER)
+ .putExtra(EXTRA_OPEN_PLAYER, true),
android.app.PendingIntent.FLAG_IMMUTABLE or
android.app.PendingIntent.FLAG_UPDATE_CURRENT,
),
diff --git a/app/src/main/java/dev/emanuele/spot/ui/MainActivity.kt b/app/src/main/java/dev/emanuele/spot/ui/MainActivity.kt
index 7a708b8..b87bc2c 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/MainActivity.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/MainActivity.kt
@@ -54,7 +54,7 @@ class MainActivity : ComponentActivity() {
android.graphics.Color.TRANSPARENT,
),
)
- if (intent?.getBooleanExtra(dev.emanuele.spot.playback.EXTRA_OPEN_PLAYER, false) == true) {
+ if (intent?.opensPlayer() == true) {
openPlayer++
}
@@ -71,11 +71,15 @@ class MainActivity : ComponentActivity() {
override fun onNewIntent(intent: android.content.Intent) {
super.onNewIntent(intent)
setIntent(intent)
- if (intent.getBooleanExtra(dev.emanuele.spot.playback.EXTRA_OPEN_PLAYER, false)) {
+ if (intent.opensPlayer()) {
openPlayer++
}
}
+ private fun android.content.Intent.opensPlayer(): Boolean =
+ action == dev.emanuele.spot.playback.ACTION_OPEN_PLAYER ||
+ getBooleanExtra(dev.emanuele.spot.playback.EXTRA_OPEN_PLAYER, false)
+
override fun onStart() {
super.onStart()
val token = SessionToken(this, ComponentName(this, PlaybackService::class.java))
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 9f090aa..7e8da28 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
@@ -203,6 +203,12 @@ fun SpotApp(
val artBackdrop = rememberLayerBackdrop()
val pageBackdrop = rememberLayerBackdrop()
+ // Everything the modals cover: the screens, the bars *and* the player. The
+ // sheets used to sample `pageBackdrop`, which stops at the navigation host,
+ // so opening one over the player blurred the home page behind it instead of
+ // the player it was opened from.
+ val overlayBackdrop = rememberLayerBackdrop()
+
// How far the player is open, 0 to 1. A value rather than a destination:
// see NowPlayingSheet for why the player stopped being a route.
val expand = remember { Animatable(0f) }
@@ -221,7 +227,13 @@ fun SpotApp(
LaunchedEffect(pendingOpen, playback.hasItem) {
if (pendingOpen && playback.hasItem) {
pendingOpen = false
- expand.animateTo(1f, expandSpec)
+ // Run outside this effect. Clearing the flag changes one of the
+ // effect's own keys, so the effect is cancelled immediately — and
+ // with it the animation, about two frames in. That is why the player
+ // "opened" and was never seen.
+ scope.launch {
+ expand.animateTo(1f, expandSpec)
+ }
}
}
@@ -303,6 +315,7 @@ fun SpotApp(
// actually beneath them, so they looked like frosted panels
// rather than like glass: nothing of the list underneath ever
// showed through.
+ Box(Modifier.fillMaxSize().layerBackdrop(overlayBackdrop)) {
Box(
Modifier
.fillMaxSize()
@@ -537,6 +550,8 @@ fun SpotApp(
)
}
+ }
+
// Above the tab bar and the now-playing bar, which is the whole
// reason it lives here instead of in the screen that asked for
// it.
@@ -547,7 +562,7 @@ fun SpotApp(
title = menu?.track?.name.orEmpty(),
subtitle = menu?.track?.artist.orEmpty(),
artworkUrl = menu?.track?.artworkUrl,
- backdrop = pageBackdrop,
+ backdrop = overlayBackdrop,
onDismiss = { trackMenu = null },
) {
if (menu != null) {
@@ -583,14 +598,12 @@ fun SpotApp(
// Over everything, including the player: the same sheet is
// opened from a track row in the library and from the plus in
// the player, and it is one sheet with one state.
- if (addToPlaylist.open) {
- AddToPlaylistSheet(
- state = addToPlaylist,
- backdrop = pageBackdrop,
- onSelect = viewModel::addToPlaylist,
- onDismiss = viewModel::closeAddToPlaylist,
- )
- }
+ AddToPlaylistSheet(
+ state = addToPlaylist,
+ backdrop = overlayBackdrop,
+ onSelect = viewModel::addToPlaylist,
+ onDismiss = viewModel::closeAddToPlaylist,
+ )
}
}
}
diff --git a/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt b/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt
index a81e90e..6f36e37 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/player/AddToPlaylistSheet.kt
@@ -1,6 +1,15 @@
package dev.emanuele.spot.ui.player
import androidx.compose.foundation.background
+import com.kyant.backdrop.effects.blur
+import com.kyant.backdrop.drawBackdrop
+import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.animation.slideOutVertically
+import androidx.compose.animation.slideInVertically
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.core.tween
+import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@@ -52,17 +61,44 @@ fun AddToPlaylistSheet(
onSelect: (CatalogPlaylist) -> Unit,
onDismiss: () -> Unit,
) {
- Box(
- Modifier
- .fillMaxSize()
- .background(Color.Black.copy(alpha = 0.45f))
- .clickable(interactionSource = null, indication = null, onClick = onDismiss),
- contentAlignment = Alignment.BottomCenter,
+ Box(Modifier.fillMaxSize()) {
+ // The page out of focus, like the track sheet: this covers the player as
+ // often as it covers a list, and a scrim alone left both perfectly readable
+ // underneath.
+ AnimatedVisibility(
+ visible = state.open,
+ enter = fadeIn(tween(200)),
+ exit = fadeOut(tween(180)),
+ modifier = Modifier.fillMaxSize(),
+ ) {
+ Box(
+ Modifier
+ .fillMaxSize()
+ .drawBackdrop(
+ backdrop = backdrop,
+ shape = { RectangleShape },
+ effects = { blur(28f.dp.toPx()) },
+ onDrawSurface = { drawRect(Color.Black.copy(alpha = 0.42f)) },
+ )
+ .clickable(interactionSource = null, indication = null, onClick = onDismiss),
+ )
+ }
+
+ AnimatedVisibility(
+ visible = state.open,
+ // Up from the bottom edge, since that is where it sits.
+ enter = slideInVertically(tween(240)) { it / 6 } + fadeIn(tween(180)),
+ exit = slideOutVertically(tween(180)) { it / 6 } + fadeOut(tween(150)),
+ modifier = Modifier.align(Alignment.BottomCenter),
) {
GlassSurface(
backdrop = backdrop,
shape = RoundedCornerShape(28.dp),
surfaceColor = GlassFilm,
+ // Heavier than the page behind it: the panel samples the unblurred
+ // layer, so at the usual radius the rows underneath came through
+ // sharper inside the sheet than outside it.
+ blurRadius = 46.dp,
modifier = Modifier
.padding(16.dp)
.fillMaxWidth()
@@ -134,6 +170,7 @@ fun AddToPlaylistSheet(
}
}
}
+ }
}
@Composable