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 Original line Diff line number Diff line
@@ -531,12 +531,20 @@ fun ContentScope.NotificationScrollingStack(
    }
    }


    val scrimNestedScrollConnection =
    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 flingSpec: DecayAnimationSpec<Float> = splineBasedDecay(density)
                val flingBehavior = NotificationScrimFlingBehavior(flingSpec)
                val flingBehavior = NotificationScrimFlingBehavior(flingSpec)
                NotificationScrimNestedScrollConnection(
                NotificationScrimNestedScrollConnection(
                    scrimOffset = { scrimOffset.value },
                    scrimOffset = { scrimOffset.value },
                snapScrimOffset = { value -> coroutineScope.launch { scrimOffset.snapTo(value) } },
                    snapScrimOffset = { value ->
                        coroutineScope.launch { scrimOffset.snapTo(value) }
                    },
                    animateScrimOffset = { value ->
                    animateScrimOffset = { value ->
                        coroutineScope.launch { scrimOffset.animateTo(value) }
                        coroutineScope.launch { scrimOffset.animateTo(value) }
                    },
                    },
@@ -547,6 +555,9 @@ fun ContentScope.NotificationScrollingStack(
                    flingBehavior = flingBehavior,
                    flingBehavior = flingBehavior,
                )
                )
            }
            }
        } else {
            null
        }


    val swipeToExpandNotificationScrollConnection =
    val swipeToExpandNotificationScrollConnection =
        shadeSession.rememberSession(
        shadeSession.rememberSession(
@@ -715,8 +726,8 @@ fun ContentScope.NotificationScrollingStack(
                modifier =
                modifier =
                    Modifier.disableSwipesWhenScrolling()
                    Modifier.disableSwipesWhenScrolling()
                        .nestedScroll(swipeToExpandNotificationScrollConnection)
                        .nestedScroll(swipeToExpandNotificationScrollConnection)
                        .thenIf(supportNestedScrolling) {
                        .thenIf(supportNestedScrolling && scrimNestedScrollConnection != null) {
                            Modifier.nestedScroll(scrimNestedScrollConnection)
                            Modifier.nestedScroll(scrimNestedScrollConnection!!)
                        }
                        }
                        .verticalScroll(scrollState, overscrollEffect = overScrollEffect)
                        .verticalScroll(scrollState, overscrollEffect = overScrollEffect)
                        .fillMaxWidth()
                        .fillMaxWidth()
+2 −1
Original line number Original line Diff line number Diff line
@@ -387,6 +387,7 @@ private fun ContentScope.QuickSettingsContent(
                    .padding(horizontal = shadeHorizontalPadding),
                    .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
        // 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
        // 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
        // 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,
            stackTopPadding = notificationStackPadding,
            stackBottomPadding = navBarBottomHeight,
            stackBottomPadding = navBarBottomHeight,
            shouldIncludeHeadsUpSpace = false,
            shouldIncludeHeadsUpSpace = false,
            supportNestedScrolling = true,
            supportNestedScrolling = false,
            modifier =
            modifier =
                Modifier.fillMaxWidth()
                Modifier.fillMaxWidth()
                    // Match the screen height with the scrim, so it covers the whole screen,
                    // Match the screen height with the scrim, so it covers the whole screen,