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

Commit 49df72cb authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Keep the snoozable HUN placeholder scrollable" into main

parents 6d303f55 5f8167ce
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace(
    viewModel: NotificationsPlaceholderViewModel,
) {

    val isHeadsUp by viewModel.isHeadsUpOrAnimatingAway.collectAsStateWithLifecycle(false)
    val isSnoozable by viewModel.isHeadsUpOrAnimatingAway.collectAsStateWithLifecycle(false)

    var scrollOffset by remember { mutableFloatStateOf(0f) }
    val headsUpInset = with(LocalDensity.current) { headsUpTopInset().toPx() }
@@ -192,7 +192,7 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace(
        )
    }

    val nestedScrollConnection =
    val snoozeScrollConnection =
        object : NestedScrollConnection {
            override suspend fun onPreFling(available: Velocity): Velocity {
                if (
@@ -206,7 +206,7 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace(
            }
        }

    LaunchedEffect(isHeadsUp) { scrollOffset = 0f }
    LaunchedEffect(isSnoozable) { scrollOffset = 0f }

    LaunchedEffect(scrollableState.isScrollInProgress) {
        if (!scrollableState.isScrollInProgress && scrollOffset <= minScrollOffset) {
@@ -230,10 +230,8 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace(
                            ),
                    )
                }
                .thenIf(isHeadsUp) {
                    Modifier.nestedScroll(nestedScrollConnection)
                        .scrollable(orientation = Orientation.Vertical, state = scrollableState)
                },
                .thenIf(isSnoozable) { Modifier.nestedScroll(snoozeScrollConnection) }
                .scrollable(orientation = Orientation.Vertical, state = scrollableState),
    )
}