android: the Now Playing scrubber uses the SliderState overload (material3 1.5) (#8533)
release / go (push) Successful in 2m5s
release / web (push) Successful in 1m20s
release / govulncheck (push) Successful in 17s
release / integration (push) Successful in 2m37s
release / android (push) Failing after 2m59s
release / Build signed APK (push) Failing after 3m26s
release / Build + push container image (push) Skipped

material3 1.5 takes a custom thumb and track only on the SliderState
overloads of Slider, so the value-based call no longer compiled (run
11508). The scrubber now passes a remembered SliderState that mirrors the
playback fraction. Dragging still seeks through onValueChange, and the
thumb and track are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 15:18:01 -05:00
co-authored by Claude Opus 5.5
parent dc9edb4fc4
commit 3a7bd2b04d
@@ -33,6 +33,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.SliderState
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
@@ -40,6 +41,7 @@ import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -623,8 +625,14 @@ private fun ScrubberRow(
// pin to surfaceVariant (= slate).
inactiveTrackColor = MaterialTheme.colorScheme.surfaceVariant,
)
// A custom thumb and track need the SliderState overload (material3 1.5
// dropped them from the value one). The state only mirrors the playback
// position: dragging seeks through onValueChange, and the new position
// comes back as `fraction`.
val sliderState = remember { SliderState(value = fraction) }
SideEffect { sliderState.value = fraction }
Slider(
value = fraction,
state = sliderState,
onValueChange = { newFraction ->
if (durationMs > 0) onSeek((newFraction * durationMs).toLong())
},