Skip to content

Native Android client for Spotify, built with Jetpack Compose

Merge PR #176: the tab bar keeps its glass while the tabs change (#172)

kota-zo1d31c7e6e88f
diff --cc base/app/src/main/java/com/music/spotui/ui/immersive/shell/backdrop/DrawBackdropModifier.kt
index 2db7f888,209e7921..4ef4bd18
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/shell/backdrop/DrawBackdropModifier.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/shell/backdrop/DrawBackdropModifier.kt
@@@ -351,18 -385,13 +351,20 @@@ private class DrawBackdropNode
exportedBackdrop?.graphicsLayer?.let { layer ->
recordLayer(this@DrawBackdropNode, layer) {
- onDrawBehind?.invoke(this)
- drawRecordedBackdrop()
- onDrawSurface?.invoke(this)
- onDrawFront?.invoke(this)
+ // Inside the surface's own shape, as on screen: a lens lifted past the bar's edge
+ // would otherwise show the blur's padding as a square of glass around it.
+ val clip = androidx.compose.ui.graphics.Path().apply {
+ addOutline(shapeProvider.shape.createOutline(size, layoutDirection, this@recordLayer))
+ }
+ clipPath(clip) {
+ onDrawBehind?.invoke(this)
+ drawRecordedBackdrop()
+ onDrawSurface?.invoke(this)
+ onDrawFront?.invoke(this)
+ }
}
+ // Signal readers (e.g. the lifted selection pill) to redraw over the newly recorded bar glass (#172).
+ exportedBackdrop?.moves = (exportedBackdrop?.moves ?: 0) + 1
}
}
diff --cc base/app/src/main/java/com/music/spotui/ui/immersive/shell/backdrop/backdrops/LayerBackdrop.kt
index 6efded53,8f2f7e09..ef4c5f54
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/shell/backdrop/backdrops/LayerBackdrop.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/shell/backdrop/backdrops/LayerBackdrop.kt
@@@ -83,7 -83,8 +83,8 @@@ class LayerBackdrop internal constructo
internal var moves by androidx.compose.runtime.mutableIntStateOf(0)
internal fun publish(source: Source) {
- if (sources.lastOrNull() === source) layerCoordinates = source.coordinates
- // Track the latest attached coordinates; avoid blanking coordinates during transitions (#172).
- if (source.coordinates != null) layerCoordinates = source.coordinates
++ // Only the newest page owns the coordinates; one not laid out yet leaves them as they are (#172).
++ if (sources.lastOrNull() === source) source.coordinates?.let { layerCoordinates = it }
moves++
}