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

Commit 55ffc50e authored by Fabián Kozynski's avatar Fabián Kozynski
Browse files

[Flexiglass] Use SceneTransitionLayoutState methods

With the nested STL, querying the transitionState directly only checks
the innermost one. Instead, use the methods that allow to check for
ancestors.

Also, drive-by fixes of other uses of LayoutState in the inner scene.

Test: manual, scroll and collapse.
Bug: 437386478
Flag: com.android.systemui.scene_container
Change-Id: I56affb42a9c49f65e3d5a76dcfd3d03b18674011
parent aa7929f6
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -58,10 +58,10 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.LocalLifecycleOwner
import com.android.compose.animation.scene.ContentScope
import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.SceneTransitionLayoutState
import com.android.compose.animation.scene.UserAction
import com.android.compose.animation.scene.UserActionResult
import com.android.compose.animation.scene.animateContentFloatAsState
import com.android.compose.animation.scene.content.state.TransitionState
import com.android.compose.animation.scene.rememberMutableSceneTransitionLayoutState
import com.android.compose.animation.scene.transitions
import com.android.compose.lifecycle.DisposableEffectWithLifecycle
@@ -306,10 +306,8 @@ private fun ContentScope.QuickSettingsContent(
        // When animating into the scene, we don't want it to be able to scroll, as it could mess
        // up with the expansion animation.
        val isScrollable =
            when (val state = layoutState.transitionState) {
                is TransitionState.Idle -> true
                is TransitionState.Transition -> state.fromContent == Scenes.QuickSettings
            }
            layoutState.isIdle(Scenes.QuickSettings) ||
                layoutState.isTransitioning(from = Scenes.QuickSettings)

        LaunchedEffectWithLifecycle(isScrollable) {
            if (!isScrollable) {
@@ -370,7 +368,7 @@ private fun ContentScope.QuickSettingsContent(
        HeadsUpNotificationSpace(
            stackScrollView = notificationStackScrollView,
            viewModel = notificationsPlaceholderViewModel,
            useHunBounds = { shouldUseQuickSettingsHunBounds(layoutState.transitionState) },
            useHunBounds = { shouldUseQuickSettingsHunBounds(layoutState) },
            modifier =
                Modifier.align(Alignment.BottomCenter)
                    .navigationBarsPadding()
@@ -408,6 +406,6 @@ private fun ContentScope.QuickSettingsContent(
    }
}

private fun shouldUseQuickSettingsHunBounds(state: TransitionState): Boolean {
    return state is TransitionState.Idle && state.currentScene == Scenes.QuickSettings
private fun shouldUseQuickSettingsHunBounds(layoutState: SceneTransitionLayoutState): Boolean {
    return layoutState.isIdle(Scenes.QuickSettings)
}