summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author burakov <burakov@google.com> 2024-12-17 18:09:10 +0000
committer Danny Burakov <burakov@google.com> 2024-12-18 02:44:18 -0800
commit9a419ce1e77d3df010b1ca8c987c38b9d4a66ff3 (patch)
treebe134deeac9f7a822970b37b156253fa8b72564c
parentc0b2a054ce999edf0de0bf0230d420d8888a0e27 (diff)
[Dual Shade] Shared element transition: lockscreen clock and shade clock
Bug: 384730787 Bug: 376659778 Test: Manually tested by opening and closing both the notifications shade and quick settings shade on a folded and unfolded device, and confirming that the shade clock is rendered in a shared element transition with lockscreen clock (and translated from/to top when transitioning over Gone scene). Flag: com.android.systemui.dual_shade Change-Id: I635e7d772095fc724978f0dc76c36987ed056a7c
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt13
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainerTransitions.kt7
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt10
3 files changed, 8 insertions, 22 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
index db33e7c628d7..79cf24b9c547 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
@@ -35,9 +35,8 @@ import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.android.compose.animation.scene.ContentScope
import com.android.compose.animation.scene.MutableSceneTransitionLayoutState
-import com.android.compose.animation.scene.SceneScope
-import com.android.compose.animation.scene.SceneTransitionLayout
import com.android.compose.modifiers.thenIf
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene
@@ -61,7 +60,7 @@ constructor(
private val clockInteractor: KeyguardClockInteractor,
) {
@Composable
- fun SceneScope.DefaultClockLayout(
+ fun ContentScope.DefaultClockLayout(
smartSpacePaddingTop: (Resources) -> Int,
isShadeLayoutWide: Boolean,
modifier: Modifier = Modifier,
@@ -95,7 +94,7 @@ constructor(
}
Column(modifier) {
- SceneTransitionLayout(state) {
+ NestedSceneTransitionLayout(state, Modifier) {
scene(splitShadeLargeClockScene) {
LargeClockWithSmartSpace(
smartSpacePaddingTop = smartSpacePaddingTop,
@@ -134,7 +133,7 @@ constructor(
}
@Composable
- private fun SceneScope.SmallClockWithSmartSpace(
+ private fun ContentScope.SmallClockWithSmartSpace(
smartSpacePaddingTop: (Resources) -> Int,
modifier: Modifier = Modifier,
) {
@@ -159,7 +158,7 @@ constructor(
}
@Composable
- private fun SceneScope.LargeClockWithSmartSpace(
+ private fun ContentScope.LargeClockWithSmartSpace(
smartSpacePaddingTop: (Resources) -> Int,
shouldOffSetClockToOneHalf: Boolean = false,
) {
@@ -200,7 +199,7 @@ constructor(
}
@Composable
- private fun SceneScope.WeatherLargeClockWithSmartSpace(
+ private fun ContentScope.WeatherLargeClockWithSmartSpace(
smartSpacePaddingTop: (Resources) -> Int,
modifier: Modifier = Modifier,
) {
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainerTransitions.kt b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainerTransitions.kt
index 55fafd5cfeca..8907aec7fd48 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainerTransitions.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/SceneContainerTransitions.kt
@@ -5,7 +5,6 @@ import androidx.compose.foundation.gestures.Orientation
import com.android.compose.animation.scene.ProgressConverter
import com.android.compose.animation.scene.TransitionKey
import com.android.compose.animation.scene.transitions
-import com.android.systemui.bouncer.ui.composable.Bouncer
import com.android.systemui.notifications.ui.composable.Notifications
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.scene.shared.model.Scenes
@@ -110,17 +109,13 @@ val SceneContainerTransitions = transitions {
// Overlay transitions
- // TODO(b/376659778): Remove this transition once nested STLs are supported.
- from(Scenes.Gone, to = Overlays.NotificationsShade) {
- toNotificationsShadeTransition(translateClock = true)
- }
to(Overlays.NotificationsShade) { toNotificationsShadeTransition() }
to(Overlays.QuickSettingsShade) { toQuickSettingsShadeTransition() }
from(Overlays.NotificationsShade, to = Overlays.QuickSettingsShade) {
notificationsShadeToQuickSettingsShadeTransition()
}
from(Scenes.Gone, to = Overlays.NotificationsShade, key = SlightlyFasterShadeCollapse) {
- toNotificationsShadeTransition(translateClock = true, durationScale = 0.9)
+ toNotificationsShadeTransition(durationScale = 0.9)
}
from(Scenes.Gone, to = Overlays.QuickSettingsShade, key = SlightlyFasterShadeCollapse) {
toQuickSettingsShadeTransition(durationScale = 0.9)
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt
index 6bdb36331709..3d62151baf2f 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/scene/ui/composable/transitions/ToNotificationsShadeTransition.kt
@@ -29,10 +29,7 @@ import com.android.systemui.shade.ui.composable.OverlayShade
import com.android.systemui.shade.ui.composable.Shade
import kotlin.time.Duration.Companion.milliseconds
-fun TransitionBuilder.toNotificationsShadeTransition(
- translateClock: Boolean = false,
- durationScale: Double = 1.0,
-) {
+fun TransitionBuilder.toNotificationsShadeTransition(durationScale: Double = 1.0) {
spec = tween(durationMillis = (DefaultDuration * durationScale).inWholeMilliseconds.toInt())
swipeSpec =
spring(
@@ -45,11 +42,6 @@ fun TransitionBuilder.toNotificationsShadeTransition(
elevateInContent = Overlays.NotificationsShade,
)
scaleSize(OverlayShade.Elements.Panel, height = 0f)
- // TODO(b/376659778): This is a temporary hack to have a shared element transition with the
- // lockscreen clock. Remove once nested STLs are supported.
- if (!translateClock) {
- translate(ClockElementKeys.smallClockElementKey)
- }
// Avoid translating the status bar with the shade panel.
translate(NotificationsShade.Elements.StatusBar)
// Slide in the shade panel from the top edge.