Skip to content

Native Android client for Spotify, built with Jetpack Compose

Seek bar: the mix's stretch no longer pulses with the beat during an AutoMix transition (the cover and the player's animation still do)

kota-zof15cb9f1e629
diff --git a/base/app/src/main/java/com/music/spotui/ui/components/AutoMixVisuals.kt b/base/app/src/main/java/com/music/spotui/ui/components/AutoMixVisuals.kt
index 0ea2d221..6522e0bd 100644
--- a/base/app/src/main/java/com/music/spotui/ui/components/AutoMixVisuals.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/components/AutoMixVisuals.kt
@@ -208,16 +208,13 @@ fun Modifier.mixBeat(pulse: MixPulse?, amount: Float = 0.035f): Modifier =
/**
* Draws the mix's stretch on a seek bar's track (the canvas holding the bar, [y] its middle): the
- * part still ahead in [color] at half strength, the part played in full, thicker on the beat.
+ * part still ahead in [color] at half strength, the part played in full. Still: the bar does not
+ * beat with the music (the cover and the player's animation do).
*/
-fun DrawScope.drawMixZone(zone: ClosedFloatingPointRange<Float>, played: Float, y: Float, thickness: Float, color: Color, pulse: Float) {
+fun DrawScope.drawMixZone(zone: ClosedFloatingPointRange<Float>, played: Float, y: Float, thickness: Float, color: Color) {
val x0 = size.width * zone.start; val x1 = size.width * zone.endInclusive
- val h = thickness * (1f + 0.8f * pulse)
+ val h = thickness
val radius = CornerRadius(h / 2)
- if (pulse > 0f) {
- val g = h * 2.6f
- drawRoundRect(color.copy(alpha = 0.22f * pulse), Offset(x0 - g / 4, y - g / 2), Size(x1 - x0 + g / 2, g), CornerRadius(g / 2))
- }
drawRoundRect(color.copy(alpha = 0.45f), Offset(x0, y - h / 2), Size(x1 - x0, h), radius)
val px = (size.width * played).coerceIn(x0, x1)
if (px > x0) drawRoundRect(color, Offset(x0, y - h / 2), Size(px - x0, h), radius)
diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt
index 00a8d341..db2882e5 100644
--- a/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/player/PlayerControls.kt
@@ -141,7 +141,6 @@ internal fun PlayerScrubber(
// AutoMix: the mix's stretch in the accent from the moment it is planned, beating while it plays.
mixZone = { state.mixCue?.zoneOn(state.durationMs, incomingShown = state.blend?.outgoingWords == false) },
mixColor = com.music.spotui.ui.immersive.Immersive.Accent,
- mixPulse = { state.mixPulse?.level() ?: 0f },
)
ScrubTimes(frame, scrub, state)
com.music.spotui.ui.components.PlaybackSpeedNote(LocalPlayerTint.current.copy(alpha = 0.8f), com.music.spotui.ui.immersive.Immersive.Accent,
diff --git a/base/app/src/main/java/com/music/spotui/ui/look/ThinSlider.kt b/base/app/src/main/java/com/music/spotui/ui/look/ThinSlider.kt
index ddc278de..08ab16d0 100644
--- a/base/app/src/main/java/com/music/spotui/ui/look/ThinSlider.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/look/ThinSlider.kt
@@ -108,7 +108,6 @@ fun ThinSlider(
mixZone: () -> ClosedFloatingPointRange<Float>? = { null },
mixColor: Color = Color.White,
/** The mix's beat, 0..1, read in the draw: the stretch thickens and glows with it. */
- mixPulse: () -> Float = { 0f },
) {
var dragging by remember { mutableStateOf(false) }
val height by animateDpAsState(
@@ -201,7 +200,7 @@ fun ThinSlider(
)
}
mixZone()?.let { z ->
- drawMixZone(z, value().coerceIn(0f, 1f) * fillFactor, size.height / 2f, size.height, mixColor, mixPulse())
+ drawMixZone(z, value().coerceIn(0f, 1f) * fillFactor, size.height / 2f, size.height, mixColor)
}
}
// Composed only while loading. The infinite animation therefore costs no
diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
index 2fbac9ca..89c6abad 100644
--- a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
@@ -633,7 +633,6 @@ fun PlayerScreen(navController: NavController) {
.padding(horizontal = 24.dp)
.padding(top = 11.dp),
mixZone = { mixCue?.zoneOn(duration, incomingShown = blend != null && outgoing == null) },
- mixPulse = { mixPulse?.level() ?: 0f },
)
Row(
modifier = Modifier
@@ -1166,7 +1165,6 @@ fun SpotifySeekBar(
/** An AutoMix mix's stretch of the bar (fractions), read in the draw; null with none. */
mixZone: () -> ClosedFloatingPointRange<Float>? = { null },
/** The mix's beat, 0..1, read in the draw. */
- mixPulse: () -> Float = { 0f },
) {
var widthPx by remember { mutableStateOf(1f) }
val seekDescription = stringResource(R.string.playback_seek_description)
@@ -1216,7 +1214,7 @@ fun SpotifySeekBar(
val f = fraction().coerceIn(0f, 1f)
drawLine(Color.White.copy(alpha = 0.3f), androidx.compose.ui.geometry.Offset(0f, y), androidx.compose.ui.geometry.Offset(size.width, y), track, androidx.compose.ui.graphics.StrokeCap.Round)
drawLine(Color.White, androidx.compose.ui.geometry.Offset(0f, y), androidx.compose.ui.geometry.Offset(size.width * f, y), track, androidx.compose.ui.graphics.StrokeCap.Round)
- mixZone()?.let { drawMixZone(it, f, y, track * 1.5f, com.music.spotui.ui.theme.AppAccent, mixPulse()) }
+ mixZone()?.let { drawMixZone(it, f, y, track * 1.5f, com.music.spotui.ui.theme.AppAccent) }
drawCircle(Color.White, radius = 5.dp.toPx(), center = androidx.compose.ui.geometry.Offset(size.width * f, y))
}
}