Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7fa54315 authored by Danny Burakov's avatar Danny Burakov Committed by Android (Google) Code Review
Browse files

Merge "[Dual Shade] Shared element transition: lockscreen clock and shade clock" into main

parents 592611bd 9a419ce1
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -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,
    ) {
+1 −6
Original line number Diff line number Diff line
@@ -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)
+1 −9
Original line number Diff line number Diff line
@@ -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.