Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +38 −22 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.IconButtonColors Loading @@ -48,6 +48,7 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.dp Loading Loading @@ -114,7 +115,7 @@ fun NavBarPill( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.clip(RoundedCornerShape(16.dp)) .defaultMinSize(minWidth = navBarWidth) .widthIn(min = navBarWidth, max = 247.dp) .background(backgroundColor) .animatedActionBorder( strokeWidth = 2.dp, Loading @@ -126,7 +127,14 @@ fun NavBarPill( .padding(horizontal = 8.dp, vertical = 6.dp) .onGloballyPositioned { expandedSize = it.size }, ) { // Should have at most 1 expanded chip var expandedChip by remember { mutableStateOf(false) } actions.fastForEach { action -> Row( horizontalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterHorizontally), verticalAlignment = Alignment.CenterVertically, ) { Image( painter = rememberDrawablePainter(action.icon), colorFilter = Loading @@ -138,25 +146,33 @@ fun NavBarPill( contentDescription = action.label, modifier = Modifier.size(16.dp).clip(CircleShape), ) if (actions.size == 1 || action.attribution != null) { if ((actions.size == 1 || action.attribution != null) && !expandedChip) { expandedChip = true Text( text = action.label, style = MaterialTheme.typography.labelSmall, maxLines = 1, overflow = TextOverflow.Ellipsis, color = outlineColor, modifier = Modifier.weight(0.63f, fill = false), ) if (action.attribution != null) { Text( text = action.attribution, style = MaterialTheme.typography.labelSmall, maxLines = 1, overflow = TextOverflow.Ellipsis, color = outlineColor, modifier = Modifier.padding(start = 4.dp).alpha(0.4f), modifier = Modifier.padding(start = 4.dp) .alpha(0.4f) .weight(0.37f, false), ) } } } } } PlatformIconButton( modifier = Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +38 −22 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.IconButtonColors Loading @@ -48,6 +48,7 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.dp Loading Loading @@ -114,7 +115,7 @@ fun NavBarPill( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.clip(RoundedCornerShape(16.dp)) .defaultMinSize(minWidth = navBarWidth) .widthIn(min = navBarWidth, max = 247.dp) .background(backgroundColor) .animatedActionBorder( strokeWidth = 2.dp, Loading @@ -126,7 +127,14 @@ fun NavBarPill( .padding(horizontal = 8.dp, vertical = 6.dp) .onGloballyPositioned { expandedSize = it.size }, ) { // Should have at most 1 expanded chip var expandedChip by remember { mutableStateOf(false) } actions.fastForEach { action -> Row( horizontalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterHorizontally), verticalAlignment = Alignment.CenterVertically, ) { Image( painter = rememberDrawablePainter(action.icon), colorFilter = Loading @@ -138,25 +146,33 @@ fun NavBarPill( contentDescription = action.label, modifier = Modifier.size(16.dp).clip(CircleShape), ) if (actions.size == 1 || action.attribution != null) { if ((actions.size == 1 || action.attribution != null) && !expandedChip) { expandedChip = true Text( text = action.label, style = MaterialTheme.typography.labelSmall, maxLines = 1, overflow = TextOverflow.Ellipsis, color = outlineColor, modifier = Modifier.weight(0.63f, fill = false), ) if (action.attribution != null) { Text( text = action.attribution, style = MaterialTheme.typography.labelSmall, maxLines = 1, overflow = TextOverflow.Ellipsis, color = outlineColor, modifier = Modifier.padding(start = 4.dp).alpha(0.4f), modifier = Modifier.padding(start = 4.dp) .alpha(0.4f) .weight(0.37f, false), ) } } } } } PlatformIconButton( modifier = Loading