Loading packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt +13 −17 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ import androidx.compose.ui.util.lerp import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.NestedScrollBehavior import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneTransitionLayoutState import com.android.compose.modifiers.height import com.android.systemui.common.ui.compose.windowinsets.LocalRawScreenHeight import com.android.systemui.common.ui.compose.windowinsets.LocalScreenCornerRadius Loading Loading @@ -157,6 +156,7 @@ fun SceneScope.ConstrainedNotificationStack( fun SceneScope.NotificationScrollingStack( viewModel: NotificationsPlaceholderViewModel, maxScrimTop: () -> Float, shouldPunchHoleBehindScrim: Boolean, modifier: Modifier = Modifier, ) { val density = LocalDensity.current Loading Loading @@ -233,7 +233,8 @@ fun SceneScope.NotificationScrollingStack( // in step with the transition so that it is 0 when it completes. if ( scrimOffset.value < 0 && layoutState.isTransitioning(from = Scenes.Shade, to = Scenes.Gone) layoutState.isTransitioning(from = Scenes.Shade, to = Scenes.Gone) || layoutState.isTransitioning(from = Scenes.Shade, to = Scenes.Lockscreen) ) { IntOffset(x = 0, y = (scrimOffset.value * expansionFraction).roundToInt()) } else { Loading @@ -246,7 +247,7 @@ fun SceneScope.NotificationScrollingStack( scrimCornerRadius, screenCornerRadius, { expansionFraction }, layoutState.isNotificationScrimTransitioning(), shouldPunchHoleBehindScrim, ) .let { scrimRounding.value.toRoundedCornerShape(it) } clip = true Loading @@ -270,18 +271,20 @@ fun SceneScope.NotificationScrollingStack( ) { // Creates a cutout in the background scrim in the shape of the notifications scrim. // Only visible when notif scrim alpha < 1, during shade expansion. if (shouldPunchHoleBehindScrim) { Spacer( modifier = Modifier.fillMaxSize().drawBehind { drawRect(Color.Black, blendMode = BlendMode.DstOut) } ) } Box( modifier = Modifier.fillMaxSize() .graphicsLayer { alpha = if (layoutState.isNotificationScrimTransitioning()) { if (shouldPunchHoleBehindScrim) { (expansionFraction / EXPANSION_FOR_MAX_SCRIM_ALPHA).coerceAtMost(1f) } else 1f } Loading Loading @@ -429,13 +432,6 @@ private fun ShadeScrimRounding.toRoundedCornerShape(radius: Dp): RoundedCornerSh ) } private fun SceneTransitionLayoutState.isNotificationScrimTransitioning(): Boolean { return isTransitioningBetween(Scenes.Gone, Scenes.Shade) || isTransitioningBetween(Scenes.Lockscreen, Scenes.Shade) || isTransitioningBetween(Scenes.Gone, Scenes.QuickSettings) || isTransitioningBetween(Scenes.Lockscreen, Scenes.QuickSettings) } private const val TAG = "FlexiNotifs" private val DEBUG_STACK_COLOR = Color(1f, 0f, 0f, 0.2f) private val DEBUG_HUN_COLOR = Color(0f, 0f, 1f, 0.2f) Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt +15 −6 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.TransitionState import com.android.compose.animation.scene.animateSceneFloatAsState import com.android.compose.modifiers.thenIf import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.systemui.battery.BatteryMeterViewController import com.android.systemui.common.ui.compose.windowinsets.LocalRawScreenHeight Loading Loading @@ -155,14 +156,21 @@ private fun SceneScope.QuickSettingsScene( qsSceneAdapter = viewModel.qsSceneAdapter ) val shouldPunchHoleBehindScrim = layoutState.isTransitioningBetween(Scenes.Gone, Scenes.QuickSettings) || layoutState.isTransitioningBetween(Scenes.Lockscreen, Scenes.QuickSettings) // TODO(b/280887232): implement the real UI. Box( modifier = modifier.fillMaxSize().graphicsLayer { // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears this modifier .fillMaxSize() .graphicsLayer { alpha = contentAlpha } .thenIf(shouldPunchHoleBehindScrim) { // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears // this // scene (and not the one under it) during a scene transition. compositingStrategy = CompositingStrategy.Offscreen alpha = contentAlpha Modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen) } ) { val isCustomizing by viewModel.qsSceneAdapter.isCustomizing.collectAsState() Loading Loading @@ -313,6 +321,7 @@ private fun SceneScope.QuickSettingsScene( NotificationScrollingStack( viewModel = notificationsPlaceholderViewModel, maxScrimTop = { screenHeight }, shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim, modifier = Modifier.fillMaxWidth().offset { IntOffset(x = 0, y = screenHeight.roundToInt()) }, ) Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt +15 −3 Original line number Diff line number Diff line Loading @@ -204,9 +204,19 @@ private fun SceneScope.SingleShade( ) val isClickable by viewModel.isClickable.collectAsState() // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears this scene val shouldPunchHoleBehindScrim = layoutState.isTransitioningBetween(Scenes.Gone, Scenes.Shade) || layoutState.isTransitioningBetween(Scenes.Lockscreen, Scenes.Shade) Box( modifier = modifier.thenIf(shouldPunchHoleBehindScrim) { // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears this // scene // (and not the one under it) during a scene transition. Box(modifier = modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)) { Modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen) } ) { Box( modifier = Modifier.fillMaxSize() Loading Loading @@ -257,6 +267,7 @@ private fun SceneScope.SingleShade( NotificationScrollingStack( viewModel = viewModel.notifications, maxScrimTop = { maxNotifScrimTop.value }, shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim, ) }, ) Loading Loading @@ -428,6 +439,7 @@ private fun SceneScope.SplitShade( NotificationScrollingStack( viewModel = viewModel.notifications, maxScrimTop = { 0f }, shouldPunchHoleBehindScrim = false, modifier = Modifier.weight(1f) .fillMaxHeight() Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt +13 −17 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ import androidx.compose.ui.util.lerp import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.NestedScrollBehavior import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneTransitionLayoutState import com.android.compose.modifiers.height import com.android.systemui.common.ui.compose.windowinsets.LocalRawScreenHeight import com.android.systemui.common.ui.compose.windowinsets.LocalScreenCornerRadius Loading Loading @@ -157,6 +156,7 @@ fun SceneScope.ConstrainedNotificationStack( fun SceneScope.NotificationScrollingStack( viewModel: NotificationsPlaceholderViewModel, maxScrimTop: () -> Float, shouldPunchHoleBehindScrim: Boolean, modifier: Modifier = Modifier, ) { val density = LocalDensity.current Loading Loading @@ -233,7 +233,8 @@ fun SceneScope.NotificationScrollingStack( // in step with the transition so that it is 0 when it completes. if ( scrimOffset.value < 0 && layoutState.isTransitioning(from = Scenes.Shade, to = Scenes.Gone) layoutState.isTransitioning(from = Scenes.Shade, to = Scenes.Gone) || layoutState.isTransitioning(from = Scenes.Shade, to = Scenes.Lockscreen) ) { IntOffset(x = 0, y = (scrimOffset.value * expansionFraction).roundToInt()) } else { Loading @@ -246,7 +247,7 @@ fun SceneScope.NotificationScrollingStack( scrimCornerRadius, screenCornerRadius, { expansionFraction }, layoutState.isNotificationScrimTransitioning(), shouldPunchHoleBehindScrim, ) .let { scrimRounding.value.toRoundedCornerShape(it) } clip = true Loading @@ -270,18 +271,20 @@ fun SceneScope.NotificationScrollingStack( ) { // Creates a cutout in the background scrim in the shape of the notifications scrim. // Only visible when notif scrim alpha < 1, during shade expansion. if (shouldPunchHoleBehindScrim) { Spacer( modifier = Modifier.fillMaxSize().drawBehind { drawRect(Color.Black, blendMode = BlendMode.DstOut) } ) } Box( modifier = Modifier.fillMaxSize() .graphicsLayer { alpha = if (layoutState.isNotificationScrimTransitioning()) { if (shouldPunchHoleBehindScrim) { (expansionFraction / EXPANSION_FOR_MAX_SCRIM_ALPHA).coerceAtMost(1f) } else 1f } Loading Loading @@ -429,13 +432,6 @@ private fun ShadeScrimRounding.toRoundedCornerShape(radius: Dp): RoundedCornerSh ) } private fun SceneTransitionLayoutState.isNotificationScrimTransitioning(): Boolean { return isTransitioningBetween(Scenes.Gone, Scenes.Shade) || isTransitioningBetween(Scenes.Lockscreen, Scenes.Shade) || isTransitioningBetween(Scenes.Gone, Scenes.QuickSettings) || isTransitioningBetween(Scenes.Lockscreen, Scenes.QuickSettings) } private const val TAG = "FlexiNotifs" private val DEBUG_STACK_COLOR = Color(1f, 0f, 0f, 0.2f) private val DEBUG_HUN_COLOR = Color(0f, 0f, 1f, 0.2f) Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt +15 −6 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.TransitionState import com.android.compose.animation.scene.animateSceneFloatAsState import com.android.compose.modifiers.thenIf import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.systemui.battery.BatteryMeterViewController import com.android.systemui.common.ui.compose.windowinsets.LocalRawScreenHeight Loading Loading @@ -155,14 +156,21 @@ private fun SceneScope.QuickSettingsScene( qsSceneAdapter = viewModel.qsSceneAdapter ) val shouldPunchHoleBehindScrim = layoutState.isTransitioningBetween(Scenes.Gone, Scenes.QuickSettings) || layoutState.isTransitioningBetween(Scenes.Lockscreen, Scenes.QuickSettings) // TODO(b/280887232): implement the real UI. Box( modifier = modifier.fillMaxSize().graphicsLayer { // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears this modifier .fillMaxSize() .graphicsLayer { alpha = contentAlpha } .thenIf(shouldPunchHoleBehindScrim) { // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears // this // scene (and not the one under it) during a scene transition. compositingStrategy = CompositingStrategy.Offscreen alpha = contentAlpha Modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen) } ) { val isCustomizing by viewModel.qsSceneAdapter.isCustomizing.collectAsState() Loading Loading @@ -313,6 +321,7 @@ private fun SceneScope.QuickSettingsScene( NotificationScrollingStack( viewModel = notificationsPlaceholderViewModel, maxScrimTop = { screenHeight }, shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim, modifier = Modifier.fillMaxWidth().offset { IntOffset(x = 0, y = screenHeight.roundToInt()) }, ) Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeScene.kt +15 −3 Original line number Diff line number Diff line Loading @@ -204,9 +204,19 @@ private fun SceneScope.SingleShade( ) val isClickable by viewModel.isClickable.collectAsState() // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears this scene val shouldPunchHoleBehindScrim = layoutState.isTransitioningBetween(Scenes.Gone, Scenes.Shade) || layoutState.isTransitioningBetween(Scenes.Lockscreen, Scenes.Shade) Box( modifier = modifier.thenIf(shouldPunchHoleBehindScrim) { // Render the scene to an offscreen buffer so that BlendMode.DstOut only clears this // scene // (and not the one under it) during a scene transition. Box(modifier = modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)) { Modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen) } ) { Box( modifier = Modifier.fillMaxSize() Loading Loading @@ -257,6 +267,7 @@ private fun SceneScope.SingleShade( NotificationScrollingStack( viewModel = viewModel.notifications, maxScrimTop = { maxNotifScrimTop.value }, shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim, ) }, ) Loading Loading @@ -428,6 +439,7 @@ private fun SceneScope.SplitShade( NotificationScrollingStack( viewModel = viewModel.notifications, maxScrimTop = { 0f }, shouldPunchHoleBehindScrim = false, modifier = Modifier.weight(1f) .fillMaxHeight() Loading