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

Commit 61d29046 authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Add madia carousel lockscreen <-> shade transition" into main

parents 5d5ef735 f5c2d1e2
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ constructor(
    private val clockInteractor: KeyguardClockInteractor,
) {
    @Composable
    fun DefaultClockLayout(
    fun SceneScope.DefaultClockLayout(
        modifier: Modifier = Modifier,
    ) {
        val currentClockLayout by clockViewModel.currentClockLayout.collectAsStateWithLifecycle()
@@ -95,7 +95,8 @@ constructor(
            }
        }

        SceneTransitionLayout(state, modifier) {
        Column(modifier) {
            SceneTransitionLayout(state) {
                scene(splitShadeLargeClockScene) {
                    LargeClockWithSmartSpace(
                        shouldOffSetClockToOneHalf = !hasCustomPositionUpdatedAnimation
@@ -116,6 +117,8 @@ constructor(
                    WeatherLargeClockWithSmartSpace(modifier = Modifier.fillMaxWidth(0.5f))
                }
            }
            with(mediaCarouselSection) { KeyguardMediaCarousel() }
        }
    }

    @Composable
@@ -136,7 +139,6 @@ constructor(
                    onTopChanged = burnIn.onSmartspaceTopChanged,
                )
            }
            with(mediaCarouselSection) { KeyguardMediaCarousel() }
        }
    }

+10 −16
Original line number Diff line number Diff line
@@ -42,23 +42,9 @@ object MediaScenePicker : ElementScenePicker {
        toSceneZIndex: Float
    ): SceneKey? {
        return when {
            // TODO: 352052894 - update with the actual scene picking
            transition.isTransitioning(from = Scenes.Lockscreen, to = Scenes.Shade) -> {
                if (transition.progress < SHADE_FRACTION) {
                    Scenes.Lockscreen
                } else {
            shouldElevateMedia(transition) -> {
                Scenes.Shade
            }
            }

            // TODO: 345467290 - update with the actual scene picking
            transition.isTransitioning(from = Scenes.Shade, to = Scenes.Lockscreen) -> {
                if (transition.progress < 1f - SHADE_FRACTION) {
                    Scenes.Shade
                } else {
                    Scenes.Lockscreen
                }
            }

            // TODO: 345467290 - update with the actual scene picking
            transition.isTransitioningBetween(Scenes.QuickSettings, Scenes.Shade) -> {
@@ -69,4 +55,12 @@ object MediaScenePicker : ElementScenePicker {
            else -> pickSingleSceneIn(scenes, transition, element)
        }
    }

    /** Returns true when the media should be laid on top of the rest for the given [transition]. */
    fun shouldElevateMedia(transition: TransitionState.Transition?): Boolean {
        if (transition == null) {
            return false
        }
        return transition.isTransitioningBetween(Scenes.Lockscreen, Scenes.Shade)
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ import com.android.systemui.common.ui.compose.windowinsets.LocalScreenCornerRadi
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.media.controls.ui.composable.MediaCarousel
import com.android.systemui.media.controls.ui.composable.MediaScenePicker
import com.android.systemui.media.controls.ui.controller.MediaCarouselController
import com.android.systemui.media.controls.ui.controller.MediaHierarchyManager
import com.android.systemui.media.controls.ui.view.MediaHost
@@ -360,7 +361,13 @@ private fun SceneScope.SingleShade(
            maxNotifScrimTop.value = quickSettingsPlaceable.height.toFloat()

            layout(constraints.maxWidth, constraints.maxHeight) {
                quickSettingsPlaceable.placeRelative(x = 0, y = 0)
                val qsZIndex =
                    if (MediaScenePicker.shouldElevateMedia(layoutState.currentTransition)) {
                        1f
                    } else {
                        0f
                    }
                quickSettingsPlaceable.placeRelative(x = 0, y = 0, zIndex = qsZIndex)
                notificationsPlaceable.placeRelative(x = 0, y = maxNotifScrimTop.value.roundToInt())
            }
        }