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

Commit d9570785 authored by omarmt's avatar omarmt
Browse files

STL compute the targetContent during DraggableHandler.onStop

Test: Just a refactor
Bug: 378470603
Flag: com.android.systemui.scene_container
Change-Id: Iaeddd28f4e891c9961b2860b74d0be3acae44b0d
parent 7d923e0e
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -408,17 +408,16 @@ private class DragControllerImpl(
        }

        val fromContent = swipeAnimation.fromContent
        val consumedVelocity: Float
        val targetContent =
            if (canChangeContent) {
            // If we are halfway between two contents, we check what the target will be based on the
            // velocity and offset of the transition, then we launch the animation.
                // If we are halfway between two contents, we check what the target will be based on
                // the velocity and offset of the transition, then we launch the animation.

                val toContent = swipeAnimation.toContent

                // Compute the destination content (and therefore offset) to settle in.
                val offset = swipeAnimation.dragOffset
                val distance = swipeAnimation.distance()
            val targetContent =
                if (
                    distance != DistanceUnspecified &&
                        shouldCommitSwipe(
@@ -433,16 +432,15 @@ private class DragControllerImpl(
                } else {
                    fromContent
                }
            consumedVelocity = swipeAnimation.animateOffset(velocity, targetContent = targetContent)
            } else {
                // We are doing an overscroll preview animation between scenes.
                check(fromContent == swipeAnimation.currentContent) {
                    "canChangeContent is false but currentContent != fromContent"
                }
            consumedVelocity = swipeAnimation.animateOffset(velocity, targetContent = fromContent)
                fromContent
            }

        return consumedVelocity
        return swipeAnimation.animateOffset(velocity, targetContent)
    }

    /**