Loading packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt +2 −2 Original line number Diff line number Diff line Loading @@ -39,9 +39,9 @@ import com.android.systemui.res.R import com.android.systemui.scene.session.ui.composable.SaveableSession import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.ui.composable.Overlay import com.android.systemui.shade.ui.composable.ChipHighlightModel import com.android.systemui.shade.ui.composable.OverlayShade import com.android.systemui.shade.ui.composable.OverlayShadeHeader import com.android.systemui.shade.ui.composable.ShadeHeader import com.android.systemui.shade.ui.composable.isFullWidthShade import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScrollView import dagger.Lazy Loading Loading @@ -102,7 +102,7 @@ constructor( } OverlayShadeHeader( viewModel = headerViewModel, notificationsHighlight = ShadeHeader.ChipHighlight.Strong, notificationsHighlight = ChipHighlightModel.Strong, 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 +2 −2 Original line number Diff line number Diff line Loading @@ -83,10 +83,10 @@ import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayContentView import com.android.systemui.res.R import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.ui.composable.Overlay import com.android.systemui.shade.ui.composable.ChipHighlightModel import com.android.systemui.shade.ui.composable.OverlayShade import com.android.systemui.shade.ui.composable.OverlayShadeHeader import com.android.systemui.shade.ui.composable.QuickSettingsOverlayHeader import com.android.systemui.shade.ui.composable.ShadeHeader import com.android.systemui.shade.ui.composable.isFullWidthShade import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape Loading Loading @@ -169,7 +169,7 @@ constructor( OverlayShadeHeader( viewModel = headerViewModel, notificationsHighlight = headerViewModel.inactiveChipHighlight, quickSettingsHighlight = ShadeHeader.ChipHighlight.Strong, quickSettingsHighlight = ChipHighlightModel.Strong, showClock = true, modifier = Modifier.element(QuickSettingsShade.Elements.StatusBar), ) Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt +3 −49 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import androidx.compose.foundation.layout.widthIn import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.remember Loading Loading @@ -146,51 +145,6 @@ object ShadeHeader { const val BatteryTestTag = "battery_meter_composable_view" const val BatteryTestTagLegacy = "battery_percentage_view" } /** Represents the background highlighting of a header icons chip. */ sealed interface ChipHighlight { val backgroundColor: Color @Composable @ReadOnlyComposable get 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 { override val backgroundColor: Color @Composable get() = MaterialTheme.colorScheme.secondary 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) } } } /** The status bar that appears above the Shade scene on small screens. */ Loading Loading @@ -365,8 +319,8 @@ fun ContentScope.ExpandedShadeHeader( @Composable fun ContentScope.OverlayShadeHeader( viewModel: ShadeHeaderViewModel, notificationsHighlight: ShadeHeader.ChipHighlight, quickSettingsHighlight: ShadeHeader.ChipHighlight, notificationsHighlight: ChipHighlightModel, quickSettingsHighlight: ChipHighlightModel, showClock: Boolean, modifier: Modifier = Modifier, ) { Loading Loading @@ -431,7 +385,7 @@ fun ContentScope.OverlayShadeHeader( with(LocalDensity.current) { (if (NewStatusBarIcons.isEnabled) 3.sp else 6.sp).toDp() } val isHighlighted = quickSettingsHighlight is ShadeHeader.ChipHighlight.Strong val isHighlighted = quickSettingsHighlight is ChipHighlightModel.Strong StatusIcons( viewModel = viewModel, useExpandedFormat = false, Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHighlightChip.kt +47 −0 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ 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.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment Loading @@ -37,6 +39,51 @@ import com.android.compose.modifiers.thenIf import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingHorizontal import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingVertical /** Represents the background and foreground colors of a ShadeHighlightChip. */ sealed interface ChipHighlightModel { val backgroundColor: Color @Composable @ReadOnlyComposable get val foregroundColor: Color @Composable @ReadOnlyComposable get val onHoveredBackgroundColor: Color @Composable @ReadOnlyComposable get data object Weak : ChipHighlightModel { 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 : ChipHighlightModel { override val backgroundColor: Color @Composable get() = MaterialTheme.colorScheme.secondary override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSecondary override val onHoveredBackgroundColor: Color @Composable get() = backgroundColor } data object Transparent : ChipHighlightModel { 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) } } /** A chip with a colored highlight. Used as an entry point for the shade. */ @Composable fun ShadeHighlightChip( Loading packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt +3 −4 Original line number Diff line number Diff line Loading @@ -34,7 +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.shade.ui.composable.ChipHighlightModel 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 @@ -156,8 +156,7 @@ class ShadeHeaderViewModelTest : SysuiTestCase() { kosmos.runTest { setEnableDesktopFeatureSet(enable = true) assertThat(underTest.inactiveChipHighlight) .isEqualTo(ShadeHeader.ChipHighlight.Transparent) assertThat(underTest.inactiveChipHighlight).isEqualTo(ChipHighlightModel.Transparent) } @Test Loading @@ -165,7 +164,7 @@ class ShadeHeaderViewModelTest : SysuiTestCase() { kosmos.runTest { setEnableDesktopFeatureSet(enable = false) assertThat(underTest.inactiveChipHighlight).isEqualTo(ShadeHeader.ChipHighlight.Weak) assertThat(underTest.inactiveChipHighlight).isEqualTo(ChipHighlightModel.Weak) } @Test Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt +2 −2 Original line number Diff line number Diff line Loading @@ -39,9 +39,9 @@ import com.android.systemui.res.R import com.android.systemui.scene.session.ui.composable.SaveableSession import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.ui.composable.Overlay import com.android.systemui.shade.ui.composable.ChipHighlightModel import com.android.systemui.shade.ui.composable.OverlayShade import com.android.systemui.shade.ui.composable.OverlayShadeHeader import com.android.systemui.shade.ui.composable.ShadeHeader import com.android.systemui.shade.ui.composable.isFullWidthShade import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScrollView import dagger.Lazy Loading Loading @@ -102,7 +102,7 @@ constructor( } OverlayShadeHeader( viewModel = headerViewModel, notificationsHighlight = ShadeHeader.ChipHighlight.Strong, notificationsHighlight = ChipHighlightModel.Strong, 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 +2 −2 Original line number Diff line number Diff line Loading @@ -83,10 +83,10 @@ import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayContentView import com.android.systemui.res.R import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.ui.composable.Overlay import com.android.systemui.shade.ui.composable.ChipHighlightModel import com.android.systemui.shade.ui.composable.OverlayShade import com.android.systemui.shade.ui.composable.OverlayShadeHeader import com.android.systemui.shade.ui.composable.QuickSettingsOverlayHeader import com.android.systemui.shade.ui.composable.ShadeHeader import com.android.systemui.shade.ui.composable.isFullWidthShade import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape Loading Loading @@ -169,7 +169,7 @@ constructor( OverlayShadeHeader( viewModel = headerViewModel, notificationsHighlight = headerViewModel.inactiveChipHighlight, quickSettingsHighlight = ShadeHeader.ChipHighlight.Strong, quickSettingsHighlight = ChipHighlightModel.Strong, showClock = true, modifier = Modifier.element(QuickSettingsShade.Elements.StatusBar), ) Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt +3 −49 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import androidx.compose.foundation.layout.widthIn import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.remember Loading Loading @@ -146,51 +145,6 @@ object ShadeHeader { const val BatteryTestTag = "battery_meter_composable_view" const val BatteryTestTagLegacy = "battery_percentage_view" } /** Represents the background highlighting of a header icons chip. */ sealed interface ChipHighlight { val backgroundColor: Color @Composable @ReadOnlyComposable get 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 { override val backgroundColor: Color @Composable get() = MaterialTheme.colorScheme.secondary 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) } } } /** The status bar that appears above the Shade scene on small screens. */ Loading Loading @@ -365,8 +319,8 @@ fun ContentScope.ExpandedShadeHeader( @Composable fun ContentScope.OverlayShadeHeader( viewModel: ShadeHeaderViewModel, notificationsHighlight: ShadeHeader.ChipHighlight, quickSettingsHighlight: ShadeHeader.ChipHighlight, notificationsHighlight: ChipHighlightModel, quickSettingsHighlight: ChipHighlightModel, showClock: Boolean, modifier: Modifier = Modifier, ) { Loading Loading @@ -431,7 +385,7 @@ fun ContentScope.OverlayShadeHeader( with(LocalDensity.current) { (if (NewStatusBarIcons.isEnabled) 3.sp else 6.sp).toDp() } val isHighlighted = quickSettingsHighlight is ShadeHeader.ChipHighlight.Strong val isHighlighted = quickSettingsHighlight is ChipHighlightModel.Strong StatusIcons( viewModel = viewModel, useExpandedFormat = false, Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHighlightChip.kt +47 −0 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ 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.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment Loading @@ -37,6 +39,51 @@ import com.android.compose.modifiers.thenIf import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingHorizontal import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingVertical /** Represents the background and foreground colors of a ShadeHighlightChip. */ sealed interface ChipHighlightModel { val backgroundColor: Color @Composable @ReadOnlyComposable get val foregroundColor: Color @Composable @ReadOnlyComposable get val onHoveredBackgroundColor: Color @Composable @ReadOnlyComposable get data object Weak : ChipHighlightModel { 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 : ChipHighlightModel { override val backgroundColor: Color @Composable get() = MaterialTheme.colorScheme.secondary override val foregroundColor: Color @Composable get() = MaterialTheme.colorScheme.onSecondary override val onHoveredBackgroundColor: Color @Composable get() = backgroundColor } data object Transparent : ChipHighlightModel { 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) } } /** A chip with a colored highlight. Used as an entry point for the shade. */ @Composable fun ShadeHighlightChip( Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelTest.kt +3 −4 Original line number Diff line number Diff line Loading @@ -34,7 +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.shade.ui.composable.ChipHighlightModel 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 @@ -156,8 +156,7 @@ class ShadeHeaderViewModelTest : SysuiTestCase() { kosmos.runTest { setEnableDesktopFeatureSet(enable = true) assertThat(underTest.inactiveChipHighlight) .isEqualTo(ShadeHeader.ChipHighlight.Transparent) assertThat(underTest.inactiveChipHighlight).isEqualTo(ChipHighlightModel.Transparent) } @Test Loading @@ -165,7 +164,7 @@ class ShadeHeaderViewModelTest : SysuiTestCase() { kosmos.runTest { setEnableDesktopFeatureSet(enable = false) assertThat(underTest.inactiveChipHighlight).isEqualTo(ShadeHeader.ChipHighlight.Weak) assertThat(underTest.inactiveChipHighlight).isEqualTo(ChipHighlightModel.Weak) } @Test Loading