diff options
4 files changed, 71 insertions, 54 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt index 58bfd08dfdbc..3ff99a8d1758 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt @@ -284,8 +284,9 @@ fun ContentScope.NotificationScrollingStack( viewModel: NotificationsPlaceholderViewModel, maxScrimTop: () -> Float, shouldPunchHoleBehindScrim: Boolean, + stackTopPadding: Dp, + stackBottomPadding: Dp, shouldFillMaxSize: Boolean = true, - shouldReserveSpaceForNavBar: Boolean = true, shouldIncludeHeadsUpSpace: Boolean = true, shouldShowScrim: Boolean = true, supportNestedScrolling: Boolean, @@ -307,10 +308,7 @@ fun ContentScope.NotificationScrollingStack( val expansionFraction by viewModel.expandFraction.collectAsStateWithLifecycle(0f) val shadeToQsFraction by viewModel.shadeToQsFraction.collectAsStateWithLifecycle(0f) - val topPadding = dimensionResource(id = R.dimen.notification_side_paddings) val navBarHeight = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding() - val bottomPadding = if (shouldReserveSpaceForNavBar) navBarHeight else 0.dp - val screenHeight = with(density) { LocalConfiguration.current.screenHeightDp.dp.toPx() } /** @@ -574,7 +572,7 @@ fun ContentScope.NotificationScrollingStack( } .stackVerticalOverscroll(coroutineScope) { scrollState.canScrollForward } .verticalScroll(scrollState) - .padding(top = topPadding) + .padding(top = stackTopPadding, bottom = stackBottomPadding) .fillMaxWidth() .onGloballyPositioned { coordinates -> stackBoundsOnScreen.value = coordinates.boundsInWindow() @@ -587,11 +585,10 @@ fun ContentScope.NotificationScrollingStack( !shouldUseLockscreenStackBounds(layoutState.transitionState) }, modifier = - Modifier.notificationStackHeight( - view = stackScrollView, - totalVerticalPadding = topPadding + bottomPadding, - ) - .onSizeChanged { size -> stackHeight.intValue = size.height }, + Modifier.notificationStackHeight(view = stackScrollView).onSizeChanged { + size -> + stackHeight.intValue = size.height + }, ) Spacer( modifier = @@ -607,7 +604,7 @@ fun ContentScope.NotificationScrollingStack( stackScrollView = stackScrollView, viewModel = viewModel, useHunBounds = { !shouldUseLockscreenHunBounds(layoutState.transitionState) }, - modifier = Modifier.padding(top = topPadding), + modifier = Modifier.padding(top = stackTopPadding), ) } } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt index 5790c4af0d77..9eb1f68dd669 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/NotificationsShadeOverlay.kt @@ -16,12 +16,15 @@ package com.android.systemui.notifications.ui.composable +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.layoutId +import androidx.compose.ui.res.dimensionResource import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.UserAction @@ -34,6 +37,7 @@ import com.android.systemui.keyguard.ui.composable.section.DefaultClockSection import com.android.systemui.lifecycle.rememberViewModel import com.android.systemui.notifications.ui.viewmodel.NotificationsShadeOverlayActionsViewModel import com.android.systemui.notifications.ui.viewmodel.NotificationsShadeOverlayContentViewModel +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 @@ -61,7 +65,6 @@ constructor( private val clockSection: DefaultClockSection, private val clockInteractor: KeyguardClockInteractor, ) : Overlay { - override val key = Overlays.NotificationsShade private val actionsViewModel: NotificationsShadeOverlayActionsViewModel by lazy { @@ -76,6 +79,9 @@ constructor( @Composable override fun ContentScope.Content(modifier: Modifier) { + + val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings) + val viewModel = rememberViewModel("NotificationsShadeOverlay-viewModel") { contentViewModelFactory.create() @@ -90,47 +96,52 @@ constructor( modifier = modifier, onScrimClicked = viewModel::onScrimClicked, ) { - Column { - if (viewModel.showHeader) { - val burnIn = rememberBurnIn(clockInteractor) + Box { + Column { + if (viewModel.showHeader) { + val burnIn = rememberBurnIn(clockInteractor) - CollapsedShadeHeader( - viewModelFactory = viewModel.shadeHeaderViewModelFactory, - createTintedIconManager = tintedIconManagerFactory::create, - createBatteryMeterViewController = - batteryMeterViewControllerFactory::create, - statusBarIconController = statusBarIconController, - modifier = - Modifier.element(NotificationsShade.Elements.StatusBar) - .layoutId(SingleShadeMeasurePolicy.LayoutId.ShadeHeader), - ) - - with(clockSection) { - SmallClock( - burnInParams = burnIn.parameters, - onTopChanged = burnIn.onSmallClockTopChanged, - modifier = Modifier.fillMaxWidth(), + CollapsedShadeHeader( + viewModelFactory = viewModel.shadeHeaderViewModelFactory, + createTintedIconManager = tintedIconManagerFactory::create, + createBatteryMeterViewController = + batteryMeterViewControllerFactory::create, + statusBarIconController = statusBarIconController, + modifier = + Modifier.element(NotificationsShade.Elements.StatusBar) + .layoutId(SingleShadeMeasurePolicy.LayoutId.ShadeHeader), ) - } - } - NotificationScrollingStack( - shadeSession = shadeSession, - stackScrollView = stackScrollView.get(), - viewModel = placeholderViewModel, - maxScrimTop = { 0f }, - shouldPunchHoleBehindScrim = false, - shouldFillMaxSize = false, - shouldReserveSpaceForNavBar = false, - shouldShowScrim = false, - supportNestedScrolling = false, - modifier = Modifier.fillMaxWidth(), - ) + with(clockSection) { + SmallClock( + burnInParams = burnIn.parameters, + onTopChanged = burnIn.onSmallClockTopChanged, + modifier = Modifier.fillMaxWidth(), + ) + } + } + NotificationScrollingStack( + shadeSession = shadeSession, + stackScrollView = stackScrollView.get(), + viewModel = placeholderViewModel, + maxScrimTop = { 0f }, + stackTopPadding = notificationStackPadding, + stackBottomPadding = notificationStackPadding, + shouldPunchHoleBehindScrim = false, + shouldFillMaxSize = false, + shouldShowScrim = false, + supportNestedScrolling = false, + modifier = Modifier.fillMaxWidth(), + ) + } // Communicates the bottom position of the drawable area within the shade to NSSL. NotificationStackCutoffGuideline( stackScrollView = stackScrollView.get(), viewModel = placeholderViewModel, + modifier = + Modifier.align(Alignment.BottomCenter) + .padding(bottom = notificationStackPadding), ) } } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt b/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt index 52adaf2a5b5d..26cf7066124a 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt @@ -74,7 +74,6 @@ import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.animateSceneDpAsState import com.android.compose.animation.scene.animateSceneFloatAsState import com.android.compose.animation.scene.content.state.TransitionState -import com.android.compose.modifiers.padding import com.android.compose.modifiers.thenIf import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.systemui.battery.BatteryMeterViewController @@ -433,12 +432,15 @@ private fun SceneScope.QuickSettingsScene( // A 1 pixel is added to compensate for any kind of rounding errors to make sure 100% that // the notification stack is entirely "below" the entire screen. val minNotificationStackTop = screenHeight.roundToInt() + 1 + val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings) NotificationScrollingStack( shadeSession = shadeSession, stackScrollView = notificationStackScrollView, viewModel = notificationsPlaceholderViewModel, maxScrimTop = { minNotificationStackTop.toFloat() }, shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim, + stackTopPadding = notificationStackPadding, + stackBottomPadding = navBarBottomHeight, shouldIncludeHeadsUpSpace = false, supportNestedScrolling = true, modifier = @@ -453,7 +455,12 @@ private fun SceneScope.QuickSettingsScene( Modifier.align(Alignment.BottomCenter) .navigationBarsPadding() .offset { IntOffset(x = 0, y = minNotificationStackTop) } - .padding(horizontal = shadeHorizontalPadding), + .padding( + start = shadeHorizontalPadding, + top = 0.dp, + end = shadeHorizontalPadding, + bottom = navBarBottomHeight, + ), ) } } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt index aefe83b781e0..0d3bab24f68f 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt @@ -36,7 +36,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.navigationBars -import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.systemBars import androidx.compose.foundation.overscroll @@ -76,7 +75,6 @@ import com.android.compose.modifiers.thenIf import com.android.systemui.battery.BatteryMeterViewController import com.android.systemui.common.ui.compose.windowinsets.CutoutLocation import com.android.systemui.common.ui.compose.windowinsets.LocalDisplayCutout -import com.android.systemui.common.ui.compose.windowinsets.LocalScreenCornerRadius import com.android.systemui.compose.modifiers.sysuiResTag import com.android.systemui.dagger.SysUISingleton import com.android.systemui.lifecycle.ExclusiveActivatable @@ -283,7 +281,7 @@ private fun SceneScope.SingleShade( key = MediaLandscapeTopOffset, canOverflow = false, ) - + val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings) val navBarHeight = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding() val mediaOffsetProvider = remember { @@ -383,6 +381,8 @@ private fun SceneScope.SingleShade( viewModel = notificationsPlaceholderViewModel, maxScrimTop = { maxNotifScrimTop.toFloat() }, shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim, + stackTopPadding = notificationStackPadding, + stackBottomPadding = navBarHeight, supportNestedScrolling = true, onEmptySpaceClick = viewModel::onEmptySpaceClicked.takeIf { isEmptySpaceClickable }, @@ -422,8 +422,6 @@ private fun SceneScope.SplitShade( modifier: Modifier = Modifier, shadeSession: SaveableSession, ) { - val screenCornerRadius = LocalScreenCornerRadius.current - val isCustomizing by viewModel.qsSceneAdapter.isCustomizing.collectAsStateWithLifecycle() val isQsEnabled by viewModel.isQsEnabled.collectAsStateWithLifecycle() val isCustomizerShowing by @@ -444,6 +442,7 @@ private fun SceneScope.SplitShade( val unfoldTranslationXForEndSide by viewModel.unfoldTranslationX(isOnStartSide = false).collectAsStateWithLifecycle(0f) + val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings) val navBarBottomHeight = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() val bottomPadding by animateDpAsState( @@ -604,8 +603,9 @@ private fun SceneScope.SplitShade( stackScrollView = notificationStackScrollView, viewModel = notificationsPlaceholderViewModel, maxScrimTop = { 0f }, + stackTopPadding = notificationStackPadding, + stackBottomPadding = notificationStackPadding, shouldPunchHoleBehindScrim = false, - shouldReserveSpaceForNavBar = false, supportNestedScrolling = false, onEmptySpaceClick = viewModel::onEmptySpaceClicked.takeIf { isEmptySpaceClickable }, @@ -624,7 +624,9 @@ private fun SceneScope.SplitShade( NotificationStackCutoffGuideline( stackScrollView = notificationStackScrollView, viewModel = notificationsPlaceholderViewModel, - modifier = Modifier.align(Alignment.BottomCenter).navigationBarsPadding(), + modifier = + Modifier.align(Alignment.BottomCenter) + .padding(bottom = notificationStackPadding + navBarBottomHeight), ) } } |