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

Commit ed5111ee authored by Yining Liu's avatar Yining Liu Committed by Android (Google) Code Review
Browse files

Merge "Avoid NSS under QuickSettingsScene to have NestedScrolling" into main

parents df7dfcb9 06e7b89b
Loading
Loading
Loading
Loading
+28 −17
Original line number Diff line number Diff line
@@ -531,12 +531,20 @@ fun ContentScope.NotificationScrollingStack(
    }

    val scrimNestedScrollConnection =
        shadeSession.rememberSession(key = "ScrimConnection", scrimOffset, minScrimTop, density) {
        if (supportNestedScrolling) {
            shadeSession.rememberSession(
                key = "ScrimConnection",
                scrimOffset,
                minScrimTop,
                density,
            ) {
                val flingSpec: DecayAnimationSpec<Float> = splineBasedDecay(density)
                val flingBehavior = NotificationScrimFlingBehavior(flingSpec)
                NotificationScrimNestedScrollConnection(
                    scrimOffset = { scrimOffset.value },
                snapScrimOffset = { value -> coroutineScope.launch { scrimOffset.snapTo(value) } },
                    snapScrimOffset = { value ->
                        coroutineScope.launch { scrimOffset.snapTo(value) }
                    },
                    animateScrimOffset = { value ->
                        coroutineScope.launch { scrimOffset.animateTo(value) }
                    },
@@ -547,6 +555,9 @@ fun ContentScope.NotificationScrollingStack(
                    flingBehavior = flingBehavior,
                )
            }
        } else {
            null
        }

    val swipeToExpandNotificationScrollConnection =
        shadeSession.rememberSession(
@@ -715,8 +726,8 @@ fun ContentScope.NotificationScrollingStack(
                modifier =
                    Modifier.disableSwipesWhenScrolling()
                        .nestedScroll(swipeToExpandNotificationScrollConnection)
                        .thenIf(supportNestedScrolling) {
                            Modifier.nestedScroll(scrimNestedScrollConnection)
                        .thenIf(supportNestedScrolling && scrimNestedScrollConnection != null) {
                            Modifier.nestedScroll(scrimNestedScrollConnection!!)
                        }
                        .verticalScroll(scrollState, overscrollEffect = overScrollEffect)
                        .fillMaxWidth()
+2 −1
Original line number Diff line number Diff line
@@ -387,6 +387,7 @@ private fun ContentScope.QuickSettingsContent(
                    .padding(horizontal = shadeHorizontalPadding),
        )

        // TODO(b/436646848): remove NotificationScrollingStack from QuickSettings
        // The minimum possible value for the top of the notification stack. In other words: how
        // high is the notification stack allowed to get when the scene is at rest. It may still be
        // translated farther upwards by a transition animation but, at rest, the top edge of its
@@ -406,7 +407,7 @@ private fun ContentScope.QuickSettingsContent(
            stackTopPadding = notificationStackPadding,
            stackBottomPadding = navBarBottomHeight,
            shouldIncludeHeadsUpSpace = false,
            supportNestedScrolling = true,
            supportNestedScrolling = false,
            modifier =
                Modifier.fillMaxWidth()
                    // Match the screen height with the scrim, so it covers the whole screen,