diff options
| author | 2024-10-31 17:53:30 +0000 | |
|---|---|---|
| committer | 2024-11-01 10:28:15 +0000 | |
| commit | c356eaf1af893662e08aca537ca5ed1c65045ff5 (patch) | |
| tree | 5cfc194d1fe0b757783c74f05da7a0dc737a64bd | |
| parent | b84b3a48675cda8314f14678fad2a7db971cdd5e (diff) | |
Define separate horizontal margins for Dual Shade.
Bug: 338033836
Flag: com.android.systemui.scene_container
Test: Verified manually by observing the shade and notifications
placement.
Change-Id: Iafa40e1b922d07f5ddf1d08f392e9dff3a68a9b7
4 files changed, 25 insertions, 9 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt index 9d4408aa7acd..46f5ecd99301 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt @@ -121,14 +121,15 @@ private fun Modifier.panelPadding(): Modifier { val systemBars = WindowInsets.systemBarsIgnoringVisibility val displayCutout = WindowInsets.displayCutout val waterfall = WindowInsets.waterfall - val contentPadding = PaddingValues(all = OverlayShade.Dimensions.ScrimContentPadding) + val horizontalPadding = + PaddingValues(horizontal = dimensionResource(id = R.dimen.shade_panel_margin_horizontal)) val combinedPadding = combinePaddings( systemBars.asPaddingValues(), displayCutout.asPaddingValues(), waterfall.asPaddingValues(), - contentPadding, + horizontalPadding, ) return if (widthSizeClass == WindowWidthSizeClass.Compact) { @@ -174,7 +175,6 @@ object OverlayShade { } object Dimensions { - val ScrimContentPadding = 16.dp val PanelCornerRadius = 46.dp val OverscrollLimit = 32.dp } diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 4007bb1fcb98..393631e3364b 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -76,6 +76,14 @@ <dimen name="large_dialog_width">472dp</dimen> <dimen name="large_screen_shade_header_height">42dp</dimen> + + <!-- + The horizontal distance between the shade overlay panel (both notifications and quick settings) + and the edge of the screen. On Compact screens in portrait orientation (< w600dp) this is + ignored in the shade layout, which takes up the full screen width without margins. + --> + <dimen name="shade_panel_margin_horizontal">24dp</dimen> + <!-- start padding is smaller to account for status icon margins coming from drawable itself --> <dimen name="hover_system_icons_container_padding_start">3dp</dimen> <dimen name="hover_system_icons_container_padding_end">4dp</dimen> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index de547add1d1a..c5e205c8aa40 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -584,6 +584,12 @@ --> <dimen name="shade_panel_width">412dp</dimen> + <!-- + The horizontal distance between the shade overlay panel (both notifications and quick settings) + and the edge of the screen. This is zero only on Compact screens (< sw600dp). + --> + <dimen name="shade_panel_margin_horizontal">0dp</dimen> + <dimen name="brightness_mirror_height">48dp</dimen> <dimen name="volume_dialog_panel_transparent_padding_right">8dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt index 96d0d766d780..827e2bfeba0f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt @@ -228,9 +228,14 @@ constructor( configurationInteractor.onAnyConfigurationChange, ) { isShadeLayoutWide, shadeMode, _ -> with(context.resources) { - // TODO(b/338033836): Define separate horizontal margins for dual shade. val marginHorizontal = - getDimensionPixelSize(R.dimen.notification_panel_margin_horizontal) + getDimensionPixelSize( + if (shadeMode is Dual) { + R.dimen.shade_panel_margin_horizontal + } else { + R.dimen.notification_panel_margin_horizontal + } + ) val horizontalPosition = when (shadeMode) { @@ -248,10 +253,7 @@ constructor( ConfigurationBasedDimensions( horizontalPosition = horizontalPosition, - marginStart = - if (horizontalPosition is HorizontalPosition.EdgeToEdge) - marginHorizontal - else 0, + marginStart = if (shadeMode is Split) 0 else marginHorizontal, marginEnd = marginHorizontal, marginBottom = getDimensionPixelSize(R.dimen.notification_panel_margin_bottom), |