Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/featurepods/vc/ui/viewmodel/AvControlsChipViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ private fun PopupChipModel.verifyShown(): PopupChipModel.Shown { } private fun PopupChipModel.Shown.verifyHasNoText() { assertThat(this.chipText).isEqualTo("") assertThat(this.chipText).isEqualTo(null) } private fun PopupChipModel.Shown.verifyHasIcon(res: Int) { Loading packages/SystemUI/src/com/android/systemui/statusbar/featurepods/av/ui/viewmodel/AvControlsChipViewModel.kt +1 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,7 @@ constructor( PopupChipModel.Shown( chipId = chipId, icons = icons(sensorActivityModel = sensorActivityModel), // TODO(405903665): Remove text after api change chipText = "", chipText = null, colors = ColorsModel.AvControlsTheme, hoverBehavior = HoverBehavior.None, ) Loading packages/SystemUI/src/com/android/systemui/statusbar/featurepods/popups/ui/compose/StatusBarPopupChip.kt +49 −39 Original line number Diff line number Diff line Loading @@ -98,6 +98,10 @@ fun StatusBarPopupChip( ) }, ) { val text = viewModel.chipText // End padding should be symmetrical if the text is omitted. val startPadding = 4.dp val endPadding = if (text != null) 8.dp else startPadding Row( horizontalArrangement = Arrangement.spacedBy(4.dp), verticalAlignment = Alignment.CenterVertically, Loading @@ -115,7 +119,7 @@ fun StatusBarPopupChip( shape = chipShape, ) .indication(interactionSource, indication) .padding(start = 4.dp, end = 8.dp), .padding(start = startPadding, end = endPadding), ) { val hoverBehavior = viewModel.hoverBehavior val chipIcons = Loading @@ -131,7 +135,7 @@ fun StatusBarPopupChip( isHovered = isHovered, ) val text = viewModel.chipText if (text != null) { val textStyle = MaterialTheme.typography.labelLarge val textMeasurer = rememberTextMeasurer() var textOverflow by remember { mutableStateOf(false) } Loading @@ -148,12 +152,17 @@ fun StatusBarPopupChip( modifier = Modifier.widthIn( max = dimensionResource(id = R.dimen.ongoing_activity_chip_max_text_width) dimensionResource( id = R.dimen.ongoing_activity_chip_max_text_width ) ) .layout { measurables, constraints -> val placeable = measurables.measure(constraints) val intrinsicWidth = textMeasurer.measure(text, textStyle, softWrap = false).size.width textMeasurer .measure(text, textStyle, softWrap = false) .size .width textOverflow = intrinsicWidth > constraints.maxWidth layout(placeable.width, placeable.height) { Loading @@ -177,6 +186,7 @@ fun StatusBarPopupChip( } } } } @Composable private fun ChipIcons( Loading packages/SystemUI/src/com/android/systemui/statusbar/featurepods/popups/ui/model/PopupChipModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ sealed class PopupChipModel { override val chipId: PopupChipId, /** Icons shown on the chip when no specific hover behavior. */ val icons: List<ChipIcon>, val chipText: String, val chipText: String?, /** Determines the colors used for the chip. Defaults to system themed colors. */ val colors: ColorsModel = ColorsModel.SystemTheme, val isPopupShown: Boolean = false, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/featurepods/vc/ui/viewmodel/AvControlsChipViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ private fun PopupChipModel.verifyShown(): PopupChipModel.Shown { } private fun PopupChipModel.Shown.verifyHasNoText() { assertThat(this.chipText).isEqualTo("") assertThat(this.chipText).isEqualTo(null) } private fun PopupChipModel.Shown.verifyHasIcon(res: Int) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/featurepods/av/ui/viewmodel/AvControlsChipViewModel.kt +1 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,7 @@ constructor( PopupChipModel.Shown( chipId = chipId, icons = icons(sensorActivityModel = sensorActivityModel), // TODO(405903665): Remove text after api change chipText = "", chipText = null, colors = ColorsModel.AvControlsTheme, hoverBehavior = HoverBehavior.None, ) Loading
packages/SystemUI/src/com/android/systemui/statusbar/featurepods/popups/ui/compose/StatusBarPopupChip.kt +49 −39 Original line number Diff line number Diff line Loading @@ -98,6 +98,10 @@ fun StatusBarPopupChip( ) }, ) { val text = viewModel.chipText // End padding should be symmetrical if the text is omitted. val startPadding = 4.dp val endPadding = if (text != null) 8.dp else startPadding Row( horizontalArrangement = Arrangement.spacedBy(4.dp), verticalAlignment = Alignment.CenterVertically, Loading @@ -115,7 +119,7 @@ fun StatusBarPopupChip( shape = chipShape, ) .indication(interactionSource, indication) .padding(start = 4.dp, end = 8.dp), .padding(start = startPadding, end = endPadding), ) { val hoverBehavior = viewModel.hoverBehavior val chipIcons = Loading @@ -131,7 +135,7 @@ fun StatusBarPopupChip( isHovered = isHovered, ) val text = viewModel.chipText if (text != null) { val textStyle = MaterialTheme.typography.labelLarge val textMeasurer = rememberTextMeasurer() var textOverflow by remember { mutableStateOf(false) } Loading @@ -148,12 +152,17 @@ fun StatusBarPopupChip( modifier = Modifier.widthIn( max = dimensionResource(id = R.dimen.ongoing_activity_chip_max_text_width) dimensionResource( id = R.dimen.ongoing_activity_chip_max_text_width ) ) .layout { measurables, constraints -> val placeable = measurables.measure(constraints) val intrinsicWidth = textMeasurer.measure(text, textStyle, softWrap = false).size.width textMeasurer .measure(text, textStyle, softWrap = false) .size .width textOverflow = intrinsicWidth > constraints.maxWidth layout(placeable.width, placeable.height) { Loading @@ -177,6 +186,7 @@ fun StatusBarPopupChip( } } } } @Composable private fun ChipIcons( Loading
packages/SystemUI/src/com/android/systemui/statusbar/featurepods/popups/ui/model/PopupChipModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ sealed class PopupChipModel { override val chipId: PopupChipId, /** Icons shown on the chip when no specific hover behavior. */ val icons: List<ChipIcon>, val chipText: String, val chipText: String?, /** Determines the colors used for the chip. Defaults to system themed colors. */ val colors: ColorsModel = ColorsModel.SystemTheme, val isPopupShown: Boolean = false, Loading