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

Commit 4c12f8f7 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Surprisingly you can translate to Float.MIN_VALUE - stackPos.y, but you...

Merge "Surprisingly you can translate to Float.MIN_VALUE - stackPos.y, but you should not." into rvc-dev am: 7b0f9562

Change-Id: I944d6ad91214b4d3749d2b6e002a94201b083e1d
parents 1cae11e8 7b0f9562
Loading
Loading
Loading
Loading
+14 −10
Original line number Original line Diff line number Diff line
@@ -89,6 +89,9 @@ public class StackAnimationController extends
    private static final int SPRING_AFTER_FLING_STIFFNESS = 750;
    private static final int SPRING_AFTER_FLING_STIFFNESS = 750;
    private static final float SPRING_AFTER_FLING_DAMPING_RATIO = 0.85f;
    private static final float SPRING_AFTER_FLING_DAMPING_RATIO = 0.85f;


    /** Sentinel value for unset position value. */
    private static final float UNSET = -Float.MIN_VALUE;

    /**
    /**
     * Minimum fling velocity required to trigger moving the stack from one side of the screen to
     * Minimum fling velocity required to trigger moving the stack from one side of the screen to
     * the other.
     * the other.
@@ -133,7 +136,7 @@ public class StackAnimationController extends
     * The Y position of the stack before the IME became visible, or {@link Float#MIN_VALUE} if the
     * The Y position of the stack before the IME became visible, or {@link Float#MIN_VALUE} if the
     * IME is not visible or the user moved the stack since the IME became visible.
     * IME is not visible or the user moved the stack since the IME became visible.
     */
     */
    private float mPreImeY = Float.MIN_VALUE;
    private float mPreImeY = UNSET;


    /**
    /**
     * Animations on the stack position itself, which would have been started in
     * Animations on the stack position itself, which would have been started in
@@ -263,7 +266,7 @@ public class StackAnimationController extends


        // If we manually move the bubbles with the IME open, clear the return point since we don't
        // If we manually move the bubbles with the IME open, clear the return point since we don't
        // want the stack to snap away from the new position.
        // want the stack to snap away from the new position.
        mPreImeY = Float.MIN_VALUE;
        mPreImeY = UNSET;


        moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_X, x);
        moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_X, x);
        moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_Y, y);
        moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_Y, y);
@@ -512,26 +515,27 @@ public class StackAnimationController extends
     * Animates the stack either away from the newly visible IME, or back to its original position
     * Animates the stack either away from the newly visible IME, or back to its original position
     * due to the IME going away.
     * due to the IME going away.
     *
     *
     * @return The destination Y value of the stack due to the IME movement.
     * @return The destination Y value of the stack due to the IME movement (or the current position
     * of the stack if it's not moving).
     */
     */
    public float animateForImeVisibility(boolean imeVisible) {
    public float animateForImeVisibility(boolean imeVisible) {
        final float maxBubbleY = getAllowableStackPositionRegion().bottom;
        final float maxBubbleY = getAllowableStackPositionRegion().bottom;
        float destinationY = Float.MIN_VALUE;
        float destinationY = UNSET;


        if (imeVisible) {
        if (imeVisible) {
            // Stack is lower than it should be and overlaps the now-visible IME.
            // Stack is lower than it should be and overlaps the now-visible IME.
            if (mStackPosition.y > maxBubbleY && mPreImeY == Float.MIN_VALUE) {
            if (mStackPosition.y > maxBubbleY && mPreImeY == UNSET) {
                mPreImeY = mStackPosition.y;
                mPreImeY = mStackPosition.y;
                destinationY = maxBubbleY;
                destinationY = maxBubbleY;
            }
            }
        } else {
        } else {
            if (mPreImeY > Float.MIN_VALUE) {
            if (mPreImeY != UNSET) {
                destinationY = mPreImeY;
                destinationY = mPreImeY;
                mPreImeY = Float.MIN_VALUE;
                mPreImeY = UNSET;
            }
            }
        }
        }


        if (destinationY > Float.MIN_VALUE) {
        if (destinationY != UNSET) {
            springFirstBubbleWithStackFollowing(
            springFirstBubbleWithStackFollowing(
                    DynamicAnimation.TRANSLATION_Y,
                    DynamicAnimation.TRANSLATION_Y,
                    getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
                    getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
@@ -542,7 +546,7 @@ public class StackAnimationController extends
            notifyFloatingCoordinatorStackAnimatingTo(mStackPosition.x, destinationY);
            notifyFloatingCoordinatorStackAnimatingTo(mStackPosition.x, destinationY);
        }
        }


        return destinationY;
        return destinationY != UNSET ? destinationY : mStackPosition.y;
    }
    }


    /**
    /**
@@ -595,7 +599,7 @@ public class StackAnimationController extends
                    mLayout.getHeight()
                    mLayout.getHeight()
                            - mBubbleSize
                            - mBubbleSize
                            - mBubblePaddingTop
                            - mBubblePaddingTop
                            - (mImeHeight > Float.MIN_VALUE ? mImeHeight + mBubblePaddingTop : 0f)
                            - (mImeHeight != UNSET ? mImeHeight + mBubblePaddingTop : 0f)
                            - Math.max(
                            - Math.max(
                            insets.getStableInsetBottom(),
                            insets.getStableInsetBottom(),
                            insets.getDisplayCutout() != null
                            insets.getDisplayCutout() != null