Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/Chip.kt +9 −4 Original line number Diff line number Diff line Loading @@ -33,9 +33,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha Loading @@ -43,6 +41,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight Loading @@ -56,11 +55,17 @@ import com.android.systemui.res.R @Composable fun Chip(action: ActionViewModel, modifier: Modifier = Modifier) { val backgroundColor = if (isSystemInDarkTheme()) Color.Black else Color.White val density = LocalDensity.current val config = LocalConfiguration.current val isBoldTextEnabled by remember { derivedStateOf { config.fontWeightAdjustment > 0 } } val isBoldTextEnabled = config.fontWeightAdjustment > 0 val fontScale = config.fontScale val chipTextStyle = MaterialTheme.typography.labelLarge.copy( fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium, fontSize = with(density) { (MaterialTheme.typography.labelLarge.fontSize.value * fontScale).dp.toSp() }, ) val haptics = LocalHapticFeedback.current Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +10 −4 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width Loading @@ -50,7 +51,6 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember Loading Loading @@ -153,10 +153,15 @@ fun NavBarPill( label = "expansion", ) val config = LocalConfiguration.current val isBoldTextEnabled by remember { derivedStateOf { config.fontWeightAdjustment > 0 } } val isBoldTextEnabled = config.fontWeightAdjustment > 0 val fontScale = config.fontScale val actionTextStyle = MaterialTheme.typography.labelMedium.copy( fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium, fontSize = with(density) { (MaterialTheme.typography.labelMedium.fontSize.value * fontScale).dp.toSp() }, ) Column( Loading Loading @@ -267,7 +272,8 @@ fun NavBarPill( Color.Transparent } ) .padding(4.dp), .height(28.dp) .padding(start = 6.dp, end = 6.dp), ) { Image( painter = rememberDrawablePainter(action.icon.drawable), Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +8 −2 Original line number Diff line number Diff line Loading @@ -142,11 +142,17 @@ fun ShortPill( var pillContentSize by remember { mutableStateOf(IntSize.Zero) } var pillContentPosition by remember { mutableStateOf(Offset.Zero) } val density = LocalDensity.current val config = LocalConfiguration.current val isBoldTextEnabled by remember { derivedStateOf { config.fontWeightAdjustment > 0 } } val fontScale = config.fontScale val actionTextStyle = MaterialTheme.typography.labelMedium.copy( fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium, fontSize = with(density) { (MaterialTheme.typography.labelMedium.fontSize.value * fontScale).dp.toSp() }, ) Box( Loading Loading @@ -260,7 +266,7 @@ fun ShortPill( // The layout for the expanded state (a single, centered button) if (expansionAlpha < 1f && pillContentSize != IntSize.Zero) { with(LocalDensity.current) { with(density) { val offsetX = pillContentPosition.x.toDp() + (pillContentSize.width.toDp() / 2) - (closeButtonSize / 2) Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/Chip.kt +9 −4 Original line number Diff line number Diff line Loading @@ -33,9 +33,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha Loading @@ -43,6 +41,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight Loading @@ -56,11 +55,17 @@ import com.android.systemui.res.R @Composable fun Chip(action: ActionViewModel, modifier: Modifier = Modifier) { val backgroundColor = if (isSystemInDarkTheme()) Color.Black else Color.White val density = LocalDensity.current val config = LocalConfiguration.current val isBoldTextEnabled by remember { derivedStateOf { config.fontWeightAdjustment > 0 } } val isBoldTextEnabled = config.fontWeightAdjustment > 0 val fontScale = config.fontScale val chipTextStyle = MaterialTheme.typography.labelLarge.copy( fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium, fontSize = with(density) { (MaterialTheme.typography.labelLarge.fontSize.value * fontScale).dp.toSp() }, ) val haptics = LocalHapticFeedback.current Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +10 −4 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width Loading @@ -50,7 +51,6 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember Loading Loading @@ -153,10 +153,15 @@ fun NavBarPill( label = "expansion", ) val config = LocalConfiguration.current val isBoldTextEnabled by remember { derivedStateOf { config.fontWeightAdjustment > 0 } } val isBoldTextEnabled = config.fontWeightAdjustment > 0 val fontScale = config.fontScale val actionTextStyle = MaterialTheme.typography.labelMedium.copy( fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium, fontSize = with(density) { (MaterialTheme.typography.labelMedium.fontSize.value * fontScale).dp.toSp() }, ) Column( Loading Loading @@ -267,7 +272,8 @@ fun NavBarPill( Color.Transparent } ) .padding(4.dp), .height(28.dp) .padding(start = 6.dp, end = 6.dp), ) { Image( painter = rememberDrawablePainter(action.icon.drawable), Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +8 −2 Original line number Diff line number Diff line Loading @@ -142,11 +142,17 @@ fun ShortPill( var pillContentSize by remember { mutableStateOf(IntSize.Zero) } var pillContentPosition by remember { mutableStateOf(Offset.Zero) } val density = LocalDensity.current val config = LocalConfiguration.current val isBoldTextEnabled by remember { derivedStateOf { config.fontWeightAdjustment > 0 } } val fontScale = config.fontScale val actionTextStyle = MaterialTheme.typography.labelMedium.copy( fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium fontWeight = if (isBoldTextEnabled) FontWeight.Bold else FontWeight.Medium, fontSize = with(density) { (MaterialTheme.typography.labelMedium.fontSize.value * fontScale).dp.toSp() }, ) Box( Loading Loading @@ -260,7 +266,7 @@ fun ShortPill( // The layout for the expanded state (a single, centered button) if (expansionAlpha < 1f && pillContentSize != IntSize.Zero) { with(LocalDensity.current) { with(density) { val offsetX = pillContentPosition.x.toDp() + (pillContentSize.width.toDp() / 2) - (closeButtonSize / 2) Loading