Loading packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ constructor( OverlayShadeHeader( viewModel = headerViewModel, notificationsHighlight = ShadeHeader.ChipHighlight.Strong, quickSettingsHighlight = ShadeHeader.ChipHighlight.Weak, quickSettingsHighlight = headerViewModel.inactiveChipHighlight, showClock = !isFullWidth, modifier = Modifier.element(NotificationsShade.Elements.StatusBar), ) Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +3 −2 Original line number Diff line number Diff line Loading @@ -165,9 +165,10 @@ constructor( }, header = { if (contentViewModel.showHeader) { val headerViewModel = quickSettingsContainerViewModel.shadeHeaderViewModel OverlayShadeHeader( viewModel = quickSettingsContainerViewModel.shadeHeaderViewModel, notificationsHighlight = ShadeHeader.ChipHighlight.Weak, viewModel = headerViewModel, notificationsHighlight = headerViewModel.inactiveChipHighlight, quickSettingsHighlight = ShadeHeader.ChipHighlight.Strong, showClock = true, modifier = Modifier.element(QuickSettingsShade.Elements.StatusBar), Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt +22 −0 Original line number Diff line number Diff line Loading @@ -155,12 +155,18 @@ object ShadeHeader { val foregroundColor: Color @Composable @ReadOnlyComposable get val onHoveredBackgroundColor: Color @Composable @ReadOnlyComposable get data object Weak : ChipHighlight { override val backgroundColor: Color @Composable get() = MaterialTheme.colorScheme.surface.copy(alpha = 0.3f) override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSurface override val onHoveredBackgroundColor: Color @Composable get() = backgroundColor } data object Strong : ChipHighlight { Loading @@ -169,6 +175,20 @@ object ShadeHeader { override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSecondary override val onHoveredBackgroundColor: Color @Composable get() = backgroundColor } data object Transparent : ChipHighlight { override val backgroundColor: Color @Composable get() = Color.Transparent override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSurface override val onHoveredBackgroundColor: Color @Composable get() = MaterialTheme.colorScheme.surface.copy(alpha = 0.3f) } } } Loading Loading @@ -357,6 +377,7 @@ fun ContentScope.OverlayShadeHeader( Box(modifier = Modifier.padding(horizontal = horizontalPadding)) { ShadeHighlightChip( backgroundColor = notificationsHighlight.backgroundColor, onHoveredBackgroundColor = notificationsHighlight.onHoveredBackgroundColor, horizontalArrangement = Arrangement.spacedBy(5.dp), onClick = viewModel::onNotificationIconChipClicked, modifier = Loading Loading @@ -390,6 +411,7 @@ fun ContentScope.OverlayShadeHeader( ) { ShadeHighlightChip( backgroundColor = quickSettingsHighlight.backgroundColor, onHoveredBackgroundColor = quickSettingsHighlight.onHoveredBackgroundColor, onClick = viewModel::onSystemIconChipClicked, modifier = Modifier.bouncy( Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHighlightChip.kt +12 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ package com.android.systemui.shade.ui.composable import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.collectIsHoveredAsState import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier Loading @@ -40,11 +42,14 @@ import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddi fun ShadeHighlightChip( modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, onHoveredBackgroundColor: Color = Color.Unspecified, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, onClick: () -> Unit = {}, content: @Composable RowScope.() -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } val isHovered by interactionSource.collectIsHoveredAsState() Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = horizontalArrangement, Loading @@ -57,7 +62,13 @@ fun ShadeHighlightChip( onClick = onClick, ) .thenIf(backgroundColor != Color.Unspecified) { Modifier.background(backgroundColor) Modifier.background( if (isHovered) { onHoveredBackgroundColor } else { backgroundColor } ) .padding(horizontal = ChipPaddingHorizontal, vertical = ChipPaddingVertical) }, content = content, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt +18 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.shade.data.repository.fakePrivacyChipRepository import com.android.systemui.shade.domain.interactor.disableDualShade import com.android.systemui.shade.domain.interactor.enableDualShade import com.android.systemui.shade.domain.interactor.enableSingleShade import com.android.systemui.shade.ui.composable.ShadeHeader import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.fakeMobileIconsInteractor import com.android.systemui.statusbar.policy.configurationController Loading Loading @@ -150,6 +151,23 @@ class ShadeHeaderViewModelTest : SysuiTestCase() { assertThat(currentOverlays).doesNotContain(Overlays.QuickSettingsShade) } @Test fun enableDesktopFeatureSetTrue_inactiveChipHighlightReturnsTransparent() = kosmos.runTest { setEnableDesktopFeatureSet(enable = true) assertThat(underTest.inactiveChipHighlight) .isEqualTo(ShadeHeader.ChipHighlight.Transparent) } @Test fun enableDesktopFeatureSetTrue_inactiveChipHighlightReturnsWeak() = kosmos.runTest { setEnableDesktopFeatureSet(enable = false) assertThat(underTest.inactiveChipHighlight).isEqualTo(ShadeHeader.ChipHighlight.Weak) } @Test fun onShadeCarrierGroupClicked_launchesNetworkSettings() = kosmos.runTest { Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ constructor( OverlayShadeHeader( viewModel = headerViewModel, notificationsHighlight = ShadeHeader.ChipHighlight.Strong, quickSettingsHighlight = ShadeHeader.ChipHighlight.Weak, quickSettingsHighlight = headerViewModel.inactiveChipHighlight, showClock = !isFullWidth, modifier = Modifier.element(NotificationsShade.Elements.StatusBar), ) Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +3 −2 Original line number Diff line number Diff line Loading @@ -165,9 +165,10 @@ constructor( }, header = { if (contentViewModel.showHeader) { val headerViewModel = quickSettingsContainerViewModel.shadeHeaderViewModel OverlayShadeHeader( viewModel = quickSettingsContainerViewModel.shadeHeaderViewModel, notificationsHighlight = ShadeHeader.ChipHighlight.Weak, viewModel = headerViewModel, notificationsHighlight = headerViewModel.inactiveChipHighlight, quickSettingsHighlight = ShadeHeader.ChipHighlight.Strong, showClock = true, modifier = Modifier.element(QuickSettingsShade.Elements.StatusBar), Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt +22 −0 Original line number Diff line number Diff line Loading @@ -155,12 +155,18 @@ object ShadeHeader { val foregroundColor: Color @Composable @ReadOnlyComposable get val onHoveredBackgroundColor: Color @Composable @ReadOnlyComposable get data object Weak : ChipHighlight { override val backgroundColor: Color @Composable get() = MaterialTheme.colorScheme.surface.copy(alpha = 0.3f) override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSurface override val onHoveredBackgroundColor: Color @Composable get() = backgroundColor } data object Strong : ChipHighlight { Loading @@ -169,6 +175,20 @@ object ShadeHeader { override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSecondary override val onHoveredBackgroundColor: Color @Composable get() = backgroundColor } data object Transparent : ChipHighlight { override val backgroundColor: Color @Composable get() = Color.Transparent override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSurface override val onHoveredBackgroundColor: Color @Composable get() = MaterialTheme.colorScheme.surface.copy(alpha = 0.3f) } } } Loading Loading @@ -357,6 +377,7 @@ fun ContentScope.OverlayShadeHeader( Box(modifier = Modifier.padding(horizontal = horizontalPadding)) { ShadeHighlightChip( backgroundColor = notificationsHighlight.backgroundColor, onHoveredBackgroundColor = notificationsHighlight.onHoveredBackgroundColor, horizontalArrangement = Arrangement.spacedBy(5.dp), onClick = viewModel::onNotificationIconChipClicked, modifier = Loading Loading @@ -390,6 +411,7 @@ fun ContentScope.OverlayShadeHeader( ) { ShadeHighlightChip( backgroundColor = quickSettingsHighlight.backgroundColor, onHoveredBackgroundColor = quickSettingsHighlight.onHoveredBackgroundColor, onClick = viewModel::onSystemIconChipClicked, modifier = Modifier.bouncy( Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHighlightChip.kt +12 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ package com.android.systemui.shade.ui.composable import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.collectIsHoveredAsState import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier Loading @@ -40,11 +42,14 @@ import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddi fun ShadeHighlightChip( modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, onHoveredBackgroundColor: Color = Color.Unspecified, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, onClick: () -> Unit = {}, content: @Composable RowScope.() -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } val isHovered by interactionSource.collectIsHoveredAsState() Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = horizontalArrangement, Loading @@ -57,7 +62,13 @@ fun ShadeHighlightChip( onClick = onClick, ) .thenIf(backgroundColor != Color.Unspecified) { Modifier.background(backgroundColor) Modifier.background( if (isHovered) { onHoveredBackgroundColor } else { backgroundColor } ) .padding(horizontal = ChipPaddingHorizontal, vertical = ChipPaddingVertical) }, content = content, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt +18 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.shade.data.repository.fakePrivacyChipRepository import com.android.systemui.shade.domain.interactor.disableDualShade import com.android.systemui.shade.domain.interactor.enableDualShade import com.android.systemui.shade.domain.interactor.enableSingleShade import com.android.systemui.shade.ui.composable.ShadeHeader import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.fakeMobileIconsInteractor import com.android.systemui.statusbar.policy.configurationController Loading Loading @@ -150,6 +151,23 @@ class ShadeHeaderViewModelTest : SysuiTestCase() { assertThat(currentOverlays).doesNotContain(Overlays.QuickSettingsShade) } @Test fun enableDesktopFeatureSetTrue_inactiveChipHighlightReturnsTransparent() = kosmos.runTest { setEnableDesktopFeatureSet(enable = true) assertThat(underTest.inactiveChipHighlight) .isEqualTo(ShadeHeader.ChipHighlight.Transparent) } @Test fun enableDesktopFeatureSetTrue_inactiveChipHighlightReturnsWeak() = kosmos.runTest { setEnableDesktopFeatureSet(enable = false) assertThat(underTest.inactiveChipHighlight).isEqualTo(ShadeHeader.ChipHighlight.Weak) } @Test fun onShadeCarrierGroupClicked_launchesNetworkSettings() = kosmos.runTest { Loading