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

Commit f8b2d0b2 authored by burakov's avatar burakov Committed by Danny Burakov
Browse files

Invocation shortcut for creating user action results that show overlays.

This is analogous to the UserActionResult(sceneKey) shortcut for
changing scenes.

Bug: 353679003
Flag: com.android.systemui.scene_container
Test: Existing unit tests still pass.
Change-Id: Id2b2bc04d3b1ffa32b663e8f784f5be14cdcd066
parent ae4b8e0f
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -550,6 +550,22 @@ sealed class UserActionResult(
             */
            requiresFullDistanceSwipe: Boolean = false,
        ): UserActionResult = ChangeScene(toScene, transitionKey, requiresFullDistanceSwipe)

        /** A [UserActionResult] that shows [toOverlay]. */
        operator fun invoke(
            /** The overlay we should be transitioning to during the [UserAction]. */
            toOverlay: OverlayKey,

            /** The key of the transition that should be used. */
            transitionKey: TransitionKey? = null,

            /**
             * If `true`, the swipe will be committed if only if the user swiped at least the swipe
             * distance, i.e. the transition progress was already equal to or bigger than 100% when
             * the user released their finger.
             */
            requiresFullDistanceSwipe: Boolean = false,
        ): UserActionResult = ShowOverlay(toOverlay, transitionKey, requiresFullDistanceSwipe)
    }
}