Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7c50711 authored by Kai Li's avatar Kai Li
Browse files

Improve ambient cue pills

Flag: com.android.systemui.enable_underlay
Bug: 403422950
Change-Id: Ia1e55d2914a105143b177efc5991c8e4159a1080
Test: https://hsv.googleplex.com/4896788963131392
parent d49ccf4b
Loading
Loading
Loading
Loading
+40 −19
Original line number Diff line number Diff line
@@ -128,12 +128,15 @@ fun NavBarPill(
                        .onGloballyPositioned { expandedSize = it.size },
            ) {
                // Should have at most 1 expanded chip
                var expandedChip by remember { mutableStateOf(false) }
                var expandedChip = false
                actions.fastForEach { action ->
                    if ((actions.size == 1 || action.attribution != null) && !expandedChip) {
                        expandedChip = true
                        Row(
                            horizontalArrangement =
                                Arrangement.spacedBy(4.dp, Alignment.CenterHorizontally),
                            verticalAlignment = Alignment.CenterVertically,
                            modifier = Modifier.weight(1f),
                        ) {
                            Image(
                                painter = rememberDrawablePainter(action.icon),
@@ -146,8 +149,7 @@ fun NavBarPill(
                                contentDescription = action.label,
                                modifier = Modifier.size(16.dp).clip(CircleShape),
                            )
                        if ((actions.size == 1 || action.attribution != null) && !expandedChip) {
                            expandedChip = true

                            Text(
                                text = action.label,
                                style = MaterialTheme.typography.labelSmall,
@@ -170,6 +172,25 @@ fun NavBarPill(
                                )
                            }
                        }
                    } else {
                        // collapsed chip
                        Row(
                            horizontalArrangement =
                                Arrangement.spacedBy(4.dp, Alignment.CenterHorizontally),
                            verticalAlignment = Alignment.CenterVertically,
                        ) {
                            Image(
                                painter = rememberDrawablePainter(action.icon),
                                colorFilter =
                                    if (action.attribution != null) {
                                        ColorFilter.tint(outlineColor)
                                    } else {
                                        null
                                    },
                                contentDescription = action.label,
                                modifier = Modifier.size(16.dp).clip(CircleShape),
                            )
                        }
                    }
                }
            }