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

Commit f2aaff27 authored by Lyn Han's avatar Lyn Han
Browse files

Chain stiffness for collapsed stack

Bug: 168646300
Test: drag collapsed stack, let go
   => see expected distance between bubbles for spring and fling

Change-Id: I0771f8c8db1a5dd449f6a1b9188ab8052f4dc8f8
parent a3e52bf4
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -72,9 +72,9 @@ public class StackAnimationController extends
    /**
     * Values to use for the default {@link SpringForce} provided to the physics animation layout.
     */
    public static final int DEFAULT_STIFFNESS = 12000;
    public static final int SPRING_TO_TOUCH_STIFFNESS = 12000;
    public static final float IME_ANIMATION_STIFFNESS = SpringForce.STIFFNESS_LOW;
    private static final int FLING_FOLLOW_STIFFNESS = 500;
    private static final int CHAIN_STIFFNESS = 600;
    public static final float DEFAULT_BOUNCINESS = 0.9f;

    private final PhysicsAnimator.SpringConfig mAnimateOutSpringConfig =
@@ -629,7 +629,7 @@ public class StackAnimationController extends
    public void moveStackFromTouch(float x, float y) {
        // Begin the spring-to-touch catch up animation if needed.
        if (mSpringToTouchOnNextMotionEvent) {
            springStack(x, y, DEFAULT_STIFFNESS);
            springStack(x, y, SPRING_TO_TOUCH_STIFFNESS);
            mSpringToTouchOnNextMotionEvent = false;
            mFirstBubbleSpringingToTouch = true;
        } else if (mFirstBubbleSpringingToTouch) {
@@ -762,14 +762,12 @@ public class StackAnimationController extends
    @Override
    SpringForce getSpringForce(DynamicAnimation.ViewProperty property, View view) {
        final ContentResolver contentResolver = mLayout.getContext().getContentResolver();
        final float stiffness = Settings.Secure.getFloat(contentResolver, "bubble_stiffness",
                mIsMovingFromFlinging ? FLING_FOLLOW_STIFFNESS : DEFAULT_STIFFNESS /* default */);
        final float dampingRatio = Settings.Secure.getFloat(contentResolver, "bubble_damping",
                DEFAULT_BOUNCINESS);

        return new SpringForce()
                .setDampingRatio(dampingRatio)
                .setStiffness(stiffness);
                .setStiffness(CHAIN_STIFFNESS);
    }

    @Override