@@ -47,8 +47,10 @@ import androidx.compose.ui.graphics.StrokeCap
4747import androidx.compose.ui.graphics.drawscope.Fill
4848import androidx.compose.ui.graphics.drawscope.Stroke
4949import androidx.compose.ui.input.pointer.pointerInput
50+ import androidx.compose.ui.res.painterResource
5051import androidx.compose.ui.unit.dp
5152import androidx.compose.ui.window.Popup
53+ import com.android.systemui.res.R
5254import com.android.systemui.statusbar.VibratorHelper;
5355import com.android.systemui.statusbar.notification.headsup.HeadsUpManager
5456import com.android.systemui.statusbar.policy.KeyguardStateController
@@ -74,6 +76,7 @@ fun OngoingActionProgress(
7476 val state by controller.state.collectAsState()
7577
7678 val accentColor = MaterialTheme .colorScheme.primary
79+ val surfaceColor = MaterialTheme .colorScheme.surface
7780
7881 AnimatedVisibility (
7982 visible = state.isVisible,
@@ -206,49 +209,57 @@ fun OngoingActionProgress(
206209 .width(140 .dp)
207210 .height(48 .dp)
208211 .shadow(8 .dp, RoundedCornerShape (24 .dp))
209- .background(Color ( 0xFF202020 ) , RoundedCornerShape (24 .dp))
212+ .background(surfaceColor , RoundedCornerShape (24 .dp))
210213 .padding(horizontal = 16 .dp),
211214 horizontalArrangement = Arrangement .SpaceBetween ,
212215 verticalAlignment = Alignment .CenterVertically
213216 ) {
214- Box (modifier = Modifier .size(32 .dp).clickable { controller.onMediaAction(0 ) }, contentAlignment = Alignment .Center ) {
215- Canvas (modifier = Modifier .size(12 .dp)) {
216- val path = Path ().apply {
217- moveTo(size.width, 0f )
218- lineTo(0f , size.height / 2 )
219- lineTo(size.width, size.height)
220- close()
221- }
222- drawPath(path, Color .White , style = Fill )
223- drawRect(Color .White , topLeft = Offset (0f , 0f ), size = Size (2 .dp.toPx(), size.height))
224- }
225- }
217+ MediaControlButton (
218+ iconRes = R .drawable.ic_media_control_skip_previous,
219+ contentDescription = " Previous" ,
220+ onClick = { controller.onMediaAction(0 ) }
221+ )
226222
227- Box (modifier = Modifier .size( 32 .dp).clickable { controller.onMediaAction( 1 ) }, contentAlignment = Alignment . Center ) {
228- Canvas (modifier = Modifier .size( 14 .dp)) {
229- drawCircle( Color . White )
230- }
231- }
223+ MediaControlButton (
224+ iconRes = R .drawable.ic_media_control_pause,
225+ contentDescription = " Pause " ,
226+ onClick = { controller.onMediaAction( 1 ) }
227+ )
232228
233- Box (modifier = Modifier .size(32 .dp).clickable { controller.onMediaAction(2 ) }, contentAlignment = Alignment .Center ) {
234- Canvas (modifier = Modifier .size(12 .dp)) {
235- val path = Path ().apply {
236- moveTo(0f , 0f )
237- lineTo(size.width, size.height / 2 )
238- lineTo(0f , size.height)
239- close()
240- }
241- drawPath(path, Color .White , style = Fill )
242- drawRect(Color .White , topLeft = Offset (size.width - 2 .dp.toPx(), 0f ), size = Size (2 .dp.toPx(), size.height))
243- }
244- }
229+ MediaControlButton (
230+ iconRes = R .drawable.ic_media_control_skip_next,
231+ contentDescription = " Next" ,
232+ onClick = { controller.onMediaAction(2 ) }
233+ )
245234 }
246235 }
247236 }
248237 }
249238 }
250239}
251240
241+ @Composable
242+ private fun MediaControlButton (
243+ iconRes : Int ,
244+ contentDescription : String ,
245+ onClick : () -> Unit ,
246+ modifier : Modifier = Modifier
247+ ) {
248+ Box (
249+ modifier = modifier
250+ .size(32 .dp)
251+ .clickable(onClick = onClick),
252+ contentAlignment = Alignment .Center
253+ ) {
254+ Image (
255+ painter = painterResource(id = iconRes),
256+ contentDescription = contentDescription,
257+ modifier = Modifier .size(24 .dp),
258+ colorFilter = ColorFilter .tint(MaterialTheme .colorScheme.onSurface)
259+ )
260+ }
261+ }
262+
252263/* *
253264 * Compose-facing controller that adapts OnGoingActionProgressController state
254265 * into Compose-friendly ProgressState.
0 commit comments