File tree Expand file tree Collapse file tree
packages/SystemUI/src/com/android/systemui/statusbar Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ import androidx.compose.ui.graphics.drawscope.Stroke
7171import androidx.compose.ui.graphics.graphicsLayer
7272import androidx.compose.ui.input.pointer.pointerInput
7373import androidx.compose.ui.layout.ContentScale
74+ import androidx.compose.ui.layout.onSizeChanged
7475import androidx.compose.ui.platform.LocalConfiguration
7576import androidx.compose.ui.res.colorResource
7677import androidx.compose.ui.res.painterResource
@@ -576,9 +577,14 @@ private fun MusicChip(
576577 Image (bmp, null , Modifier .size(15 .dp).clip(RoundedCornerShape (4 .dp)))
577578 Spacer (Modifier .width(4 .dp))
578579 }
580+ var chipAtMaxWidth by remember { mutableStateOf(false ) }
581+ val chipMaxWidthPx = with (androidx.compose.ui.platform.LocalDensity .current) { 85 .dp.roundToPx() }
579582 Box (
580- Modifier .fadingEdge(
581- Brush .horizontalGradient(0.85f to Color .White , 1f to Color .Transparent ))
583+ if (chipAtMaxWidth)
584+ Modifier .fadingEdge(
585+ Brush .horizontalGradient(0.85f to Color .White , 1f to Color .Transparent ))
586+ else
587+ Modifier
582588 ) {
583589 Text (
584590 text = state.trackTitle ? : " " ,
@@ -589,6 +595,7 @@ private fun MusicChip(
589595 modifier = Modifier
590596 .basicMarquee(initialDelayMillis = 15_000 , repeatDelayMillis = 15_000 )
591597 .padding(start = 1 .dp)
598+ .onSizeChanged { size -> chipAtMaxWidth = size.width >= chipMaxWidthPx }
592599 )
593600 }
594601 }
You can’t perform that action at this time.
0 commit comments