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

Commit 4791b8f7 authored by András Kurucz's avatar András Kurucz
Browse files

[Flexiglass] Make NotificationStackCutoffGuideline a shared element

The cutoff guideline drives the shelf's position. Make it a shared
element to ensure a smooth transition of the shelf between scenes.

Bug: 330468684
Test: observe the shelf in the shade -> qs transitions
Test: scroll notifications into the shelf
Flag: com.android.systemui.scene_container
Change-Id: Iac78e46af9dbde3439db045278dc96b14377ea0f
parent 4eb961f3
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ object Notifications {
        val HeadsUpNotificationPlaceholder =
            ElementKey("HeadsUpNotificationPlaceholder", scenePicker = LowestZIndexScenePicker)
        val ShelfSpace = ElementKey("ShelfSpace")
        val NotificationStackCutoffGuideline = ElementKey("NotificationStackCutoffGuideline")
    }

    // Expansion fraction thresholds (between 0-1f) at which the corresponding value should be
@@ -410,14 +411,18 @@ fun SceneScope.NotificationShelfSpace(
 * the notification contents (stack, footer, shelf) should be drawn.
 */
@Composable
fun NotificationStackCutoffGuideline(
fun SceneScope.NotificationStackCutoffGuideline(
    stackScrollView: NotificationScrollView,
    viewModel: NotificationsPlaceholderViewModel,
    modifier: Modifier = Modifier,
) {
    Spacer(
        modifier =
            modifier.fillMaxWidth().height(0.dp).onGloballyPositioned { coordinates ->
            modifier
                .element(key = Notifications.Elements.NotificationStackCutoffGuideline)
                .fillMaxWidth()
                .height(0.dp)
                .onGloballyPositioned { coordinates ->
                    val positionY = coordinates.positionInWindow().y
                    debugLog(viewModel) { "STACK cutoff onGloballyPositioned: y=$positionY" }
                    stackScrollView.setStackCutoff(positionY)