Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +28 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { override val id: String = "default" Loading @@ -59,6 +66,8 @@ constructor( @Composable override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( viewModel = viewModel.longPress, Loading @@ -68,10 +77,27 @@ constructor( content = { // Constrained to above the lock icon. Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt +27 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { override val id: String = "shortcuts-besides-udfps" Loading @@ -59,6 +66,8 @@ constructor( @Composable override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( viewModel = viewModel.longPress, Loading @@ -68,11 +77,27 @@ constructor( content = { // Constrained to above the lock icon. Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt +2 −1 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ constructor( val burnIn = rememberBurnIn(clockInteractor) val resources = LocalContext.current.resources val currentClockState = clockViewModel.currentClock.collectAsState() val areNotificationsVisible by viewModel.areNotificationsVisible.collectAsState() LockscreenLongPress( viewModel = viewModel.longPress, modifier = modifier, Loading Loading @@ -145,7 +146,7 @@ constructor( with(mediaCarouselSection) { MediaCarousel() } if (viewModel.areNotificationsVisible) { if (areNotificationsVisible) { with(notificationSection) { Notifications( modifier = Modifier.fillMaxWidth().weight(weight = 1f) Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt +33 −1 Original line number Diff line number Diff line Loading @@ -17,12 +17,25 @@ package com.android.systemui.keyguard.ui.composable.section import android.view.ViewGroup import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel import com.android.systemui.notifications.ui.composable.NotificationStack import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder Loading @@ -39,6 +52,7 @@ constructor( sharedNotificationContainerViewModel: SharedNotificationContainerViewModel, stackScrollLayout: NotificationStackScrollLayout, sharedNotificationContainerBinder: SharedNotificationContainerBinder, private val lockscreenContentViewModel: LockscreenContentViewModel, ) { init { Loading @@ -65,9 +79,27 @@ constructor( @Composable fun SceneScope.Notifications(modifier: Modifier = Modifier) { val shouldUseSplitNotificationShade by lockscreenContentViewModel.shouldUseSplitNotificationShade.collectAsState() val areNotificationsVisible by lockscreenContentViewModel.areNotificationsVisible.collectAsState() val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } if (!areNotificationsVisible) { return } NotificationStack( viewModel = viewModel, modifier = modifier, modifier = modifier.fillMaxWidth().thenIf(shouldUseSplitNotificationShade) { Modifier.padding(top = splitShadeTopMargin) }, ) } } packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt +65 −141 Original line number Diff line number Diff line Loading @@ -16,30 +16,20 @@ package com.android.systemui.keyguard.ui.composable.section import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene Loading @@ -48,8 +38,6 @@ import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.splitSh import com.android.systemui.keyguard.ui.composable.blueprint.ClockTransition import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import javax.inject.Inject class TopAreaSection Loading @@ -58,19 +46,16 @@ constructor( private val clockViewModel: KeyguardClockViewModel, private val smartSpaceSection: SmartSpaceSection, private val mediaCarouselSection: MediaCarouselSection, private val notificationSection: NotificationSection, private val clockSection: DefaultClockSection, private val clockInteractor: KeyguardClockInteractor, ) { @Composable fun DefaultClockLayoutWithNotifications( fun DefaultClockLayout( modifier: Modifier = Modifier, ) { val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() val currentClockLayout by clockViewModel.currentClockLayout.collectAsState() val hasCustomPositionUpdatedAnimation by clockViewModel.hasCustomPositionUpdatedAnimation.collectAsState() val currentScene = when (currentClockLayout) { KeyguardClockViewModel.ClockLayout.SPLIT_SHADE_LARGE_CLOCK -> Loading @@ -81,86 +66,34 @@ constructor( KeyguardClockViewModel.ClockLayout.SMALL_CLOCK -> smallClockScene } val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } val burnIn = rememberBurnIn(clockInteractor) LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } SceneTransitionLayout( modifier = modifier.fillMaxSize(), modifier = modifier, currentScene = currentScene, onChangeScene = {}, transitions = ClockTransition.defaultClockTransitions, enableInterruptions = false, ) { scene(splitShadeLargeClockScene) { Box(modifier = Modifier.fillMaxSize()) { Column( modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, ) { with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, LargeClockWithSmartSpace( shouldOffSetClockToOneHalf = !hasCustomPositionUpdatedAnimation ) } with(clockSection) { LargeClock( modifier = Modifier.fillMaxSize().thenIf( !hasCustomPositionUpdatedAnimation ) { // If we do not have a custom position animation, we want // the clock to be on one half of the screen. Modifier.offset { IntOffset( x = -clockSection .getClockCenteringDistance() .toInt(), y = 0, ) } } ) } } scene(splitShadeSmallClockScene) { SmallClockWithSmartSpace(modifier = Modifier.fillMaxWidth(0.5f)) } Row( modifier = Modifier.fillMaxSize(), ) { Spacer(modifier = Modifier.weight(weight = 1f)) with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } scene(smallClockScene) { SmallClockWithSmartSpace() } scene(largeClockScene) { LargeClockWithSmartSpace() } } } scene(splitShadeSmallClockScene) { Row( modifier = Modifier.fillMaxSize(), ) { Column( modifier = Modifier.fillMaxHeight().weight(weight = 1f), horizontalAlignment = Alignment.CenterHorizontally, ) { @Composable private fun SceneScope.SmallClockWithSmartSpace(modifier: Modifier = Modifier) { val burnIn = rememberBurnIn(clockInteractor) Column(modifier = modifier) { with(clockSection) { SmallClock( burnInParams = burnIn.parameters, Loading @@ -176,49 +109,40 @@ constructor( } with(mediaCarouselSection) { MediaCarousel() } } with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } @Composable private fun SceneScope.LargeClockWithSmartSpace(shouldOffSetClockToOneHalf: Boolean = false) { val burnIn = rememberBurnIn(clockInteractor) val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } scene(smallClockScene) { Column { with(clockSection) { SmallClock( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmallClockTopChanged, modifier = Modifier.wrapContentSize() ) } with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, ) } with(mediaCarouselSection) { MediaCarousel() } with(notificationSection) { Notifications(modifier = Modifier.fillMaxWidth().weight(weight = 1f)) } } } scene(largeClockScene) { Column { with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, with(clockSection) { LargeClock( modifier = Modifier.fillMaxSize().thenIf(shouldOffSetClockToOneHalf) { // If we do not have a custom position animation, we want // the clock to be on one half of the screen. Modifier.offset { IntOffset( x = -clockSection.getClockCenteringDistance().toInt(), y = 0, ) } with(clockSection) { LargeClock(modifier = Modifier.fillMaxSize()) } } ) } } } Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +28 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { override val id: String = "default" Loading @@ -59,6 +66,8 @@ constructor( @Composable override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( viewModel = viewModel.longPress, Loading @@ -68,10 +77,27 @@ constructor( content = { // Constrained to above the lock icon. Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt +27 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { override val id: String = "shortcuts-besides-udfps" Loading @@ -59,6 +66,8 @@ constructor( @Composable override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( viewModel = viewModel.longPress, Loading @@ -68,11 +77,27 @@ constructor( content = { // Constrained to above the lock icon. Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt +2 −1 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ constructor( val burnIn = rememberBurnIn(clockInteractor) val resources = LocalContext.current.resources val currentClockState = clockViewModel.currentClock.collectAsState() val areNotificationsVisible by viewModel.areNotificationsVisible.collectAsState() LockscreenLongPress( viewModel = viewModel.longPress, modifier = modifier, Loading Loading @@ -145,7 +146,7 @@ constructor( with(mediaCarouselSection) { MediaCarousel() } if (viewModel.areNotificationsVisible) { if (areNotificationsVisible) { with(notificationSection) { Notifications( modifier = Modifier.fillMaxWidth().weight(weight = 1f) Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt +33 −1 Original line number Diff line number Diff line Loading @@ -17,12 +17,25 @@ package com.android.systemui.keyguard.ui.composable.section import android.view.ViewGroup import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel import com.android.systemui.notifications.ui.composable.NotificationStack import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder Loading @@ -39,6 +52,7 @@ constructor( sharedNotificationContainerViewModel: SharedNotificationContainerViewModel, stackScrollLayout: NotificationStackScrollLayout, sharedNotificationContainerBinder: SharedNotificationContainerBinder, private val lockscreenContentViewModel: LockscreenContentViewModel, ) { init { Loading @@ -65,9 +79,27 @@ constructor( @Composable fun SceneScope.Notifications(modifier: Modifier = Modifier) { val shouldUseSplitNotificationShade by lockscreenContentViewModel.shouldUseSplitNotificationShade.collectAsState() val areNotificationsVisible by lockscreenContentViewModel.areNotificationsVisible.collectAsState() val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } if (!areNotificationsVisible) { return } NotificationStack( viewModel = viewModel, modifier = modifier, modifier = modifier.fillMaxWidth().thenIf(shouldUseSplitNotificationShade) { Modifier.padding(top = splitShadeTopMargin) }, ) } }
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt +65 −141 Original line number Diff line number Diff line Loading @@ -16,30 +16,20 @@ package com.android.systemui.keyguard.ui.composable.section import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene Loading @@ -48,8 +38,6 @@ import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.splitSh import com.android.systemui.keyguard.ui.composable.blueprint.ClockTransition import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import javax.inject.Inject class TopAreaSection Loading @@ -58,19 +46,16 @@ constructor( private val clockViewModel: KeyguardClockViewModel, private val smartSpaceSection: SmartSpaceSection, private val mediaCarouselSection: MediaCarouselSection, private val notificationSection: NotificationSection, private val clockSection: DefaultClockSection, private val clockInteractor: KeyguardClockInteractor, ) { @Composable fun DefaultClockLayoutWithNotifications( fun DefaultClockLayout( modifier: Modifier = Modifier, ) { val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() val currentClockLayout by clockViewModel.currentClockLayout.collectAsState() val hasCustomPositionUpdatedAnimation by clockViewModel.hasCustomPositionUpdatedAnimation.collectAsState() val currentScene = when (currentClockLayout) { KeyguardClockViewModel.ClockLayout.SPLIT_SHADE_LARGE_CLOCK -> Loading @@ -81,86 +66,34 @@ constructor( KeyguardClockViewModel.ClockLayout.SMALL_CLOCK -> smallClockScene } val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } val burnIn = rememberBurnIn(clockInteractor) LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } SceneTransitionLayout( modifier = modifier.fillMaxSize(), modifier = modifier, currentScene = currentScene, onChangeScene = {}, transitions = ClockTransition.defaultClockTransitions, enableInterruptions = false, ) { scene(splitShadeLargeClockScene) { Box(modifier = Modifier.fillMaxSize()) { Column( modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, ) { with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, LargeClockWithSmartSpace( shouldOffSetClockToOneHalf = !hasCustomPositionUpdatedAnimation ) } with(clockSection) { LargeClock( modifier = Modifier.fillMaxSize().thenIf( !hasCustomPositionUpdatedAnimation ) { // If we do not have a custom position animation, we want // the clock to be on one half of the screen. Modifier.offset { IntOffset( x = -clockSection .getClockCenteringDistance() .toInt(), y = 0, ) } } ) } } scene(splitShadeSmallClockScene) { SmallClockWithSmartSpace(modifier = Modifier.fillMaxWidth(0.5f)) } Row( modifier = Modifier.fillMaxSize(), ) { Spacer(modifier = Modifier.weight(weight = 1f)) with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } scene(smallClockScene) { SmallClockWithSmartSpace() } scene(largeClockScene) { LargeClockWithSmartSpace() } } } scene(splitShadeSmallClockScene) { Row( modifier = Modifier.fillMaxSize(), ) { Column( modifier = Modifier.fillMaxHeight().weight(weight = 1f), horizontalAlignment = Alignment.CenterHorizontally, ) { @Composable private fun SceneScope.SmallClockWithSmartSpace(modifier: Modifier = Modifier) { val burnIn = rememberBurnIn(clockInteractor) Column(modifier = modifier) { with(clockSection) { SmallClock( burnInParams = burnIn.parameters, Loading @@ -176,49 +109,40 @@ constructor( } with(mediaCarouselSection) { MediaCarousel() } } with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } @Composable private fun SceneScope.LargeClockWithSmartSpace(shouldOffSetClockToOneHalf: Boolean = false) { val burnIn = rememberBurnIn(clockInteractor) val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } scene(smallClockScene) { Column { with(clockSection) { SmallClock( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmallClockTopChanged, modifier = Modifier.wrapContentSize() ) } with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, ) } with(mediaCarouselSection) { MediaCarousel() } with(notificationSection) { Notifications(modifier = Modifier.fillMaxWidth().weight(weight = 1f)) } } } scene(largeClockScene) { Column { with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, with(clockSection) { LargeClock( modifier = Modifier.fillMaxSize().thenIf(shouldOffSetClockToOneHalf) { // If we do not have a custom position animation, we want // the clock to be on one half of the screen. Modifier.offset { IntOffset( x = -clockSection.getClockCenteringDistance().toInt(), y = 0, ) } with(clockSection) { LargeClock(modifier = Modifier.fillMaxSize()) } } ) } } } Loading