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

Commit 9db297f7 authored by Kai Li's avatar Kai Li Committed by Android (Google) Code Review
Browse files

Merge "Improve ambient cue pills" into main

parents 3a124c42 e7c50711
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),
                            )
                        }
                    }
                }
            }