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

Commit a3292406 authored by Shawn Lee's avatar Shawn Lee Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Gradually reset scrim offset while expanding QS" into main

parents 1a83e792 776dd25d
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -290,6 +290,7 @@ fun SceneScope.NotificationScrollingStack(
    val isCurrentGestureOverscroll =
        viewModel.isCurrentGestureOverscroll.collectAsStateWithLifecycle(false)
    val expansionFraction by viewModel.expandFraction.collectAsStateWithLifecycle(0f)
    val shadeToQsFraction by viewModel.shadeToQsFraction.collectAsStateWithLifecycle(0f)

    val topPadding = dimensionResource(id = R.dimen.notification_side_paddings)
    val navBarHeight = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
@@ -385,14 +386,26 @@ fun SceneScope.NotificationScrollingStack(
            modifier
                .element(Notifications.Elements.NotificationScrim)
                .offset {
                    // if scrim is expanded while transitioning to Gone scene, increase the offset
                    // in step with the transition so that it is 0 when it completes.
                    // if scrim is expanded while transitioning to Gone or QS scene, increase the
                    // offset in step with the corresponding 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.Lockscreen)
                    ) {
                        IntOffset(x = 0, y = (scrimOffset.value * expansionFraction).roundToInt())
                    } else if (
                        scrimOffset.value < 0 &&
                            layoutState.isTransitioning(
                                from = Scenes.Shade,
                                to = Scenes.QuickSettings
                            )
                    ) {
                        IntOffset(
                            x = 0,
                            y = (scrimOffset.value * (1 - shadeToQsFraction)).roundToInt()
                        )
                    } else {
                        IntOffset(x = 0, y = scrimOffset.value.roundToInt())
                    }
+6 −0
Original line number Diff line number Diff line
@@ -90,6 +90,12 @@ constructor(
     */
    val expandFraction: Flow<Float> = shadeInteractor.anyExpansion.dumpValue("expandFraction")

    /**
     * The amount [0-1] that quick settings has been opened. At 0, the shade may be open or closed;
     * at 1, the quick settings are open.
     */
    val shadeToQsFraction: Flow<Float> = shadeInteractor.qsExpansion.dumpValue("shadeToQsFraction")

    /**
     * The amount in px that the notification stack should scroll due to internal expansion. This
     * should only happen when a notification expansion hits the bottom of the screen, so it is