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

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

Merge "STL compute the targetContent during DraggableHandler.onStop" into main

parents 362ce034 d9570785
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)
    }

    /**