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

Commit 48f372c5 authored by Josh Tsuji's avatar Josh Tsuji Committed by android-build-merger
Browse files

Merge "Update the stack bounds for IME changes even if we're expanded." into qt-dev

am: d86369ae

Change-Id: I3dac5279e7dd1981e7c479b3cdbd7fab0028e564
parents fbf77eff d86369ae
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -717,12 +717,10 @@ public class BubbleStackView extends FrameLayout {


    /** Moves the bubbles out of the way if they're going to be over the keyboard. */
    /** Moves the bubbles out of the way if they're going to be over the keyboard. */
    public void onImeVisibilityChanged(boolean visible, int height) {
    public void onImeVisibilityChanged(boolean visible, int height) {
        mStackAnimationController.setImeHeight(height + mImeOffset);

        if (!mIsExpanded) {
        if (!mIsExpanded) {
            if (visible) {
            mStackAnimationController.animateForImeVisibility(visible);
                mStackAnimationController.updateBoundsForVisibleImeAndAnimate(height + mImeOffset);
            } else {
                mStackAnimationController.updateBoundsForInvisibleImeAndAnimate();
            }
        }
        }
    }
    }


+22 −25
Original line number Original line Diff line number Diff line
@@ -334,41 +334,38 @@ public class StackAnimationController extends
        mLayout.removeEndActionForProperty(DynamicAnimation.TRANSLATION_Y);
        mLayout.removeEndActionForProperty(DynamicAnimation.TRANSLATION_Y);
    }
    }


    /**
    /** Save the current IME height so that we know where the stack bounds should be. */
     * Save the IME height so that the allowable stack bounds reflect the now-visible IME, and
    public void setImeHeight(int imeHeight) {
     * animate the stack out of the way if necessary.
     */
    public void updateBoundsForVisibleImeAndAnimate(int imeHeight) {
        mImeHeight = imeHeight;
        mImeHeight = imeHeight;
    }


    /**
     * Animates the stack either away from the newly visible IME, or back to its original position
     * due to the IME going away.
     */
    public void animateForImeVisibility(boolean imeVisible) {
        final float maxBubbleY = getAllowableStackPositionRegion().bottom;
        final float maxBubbleY = getAllowableStackPositionRegion().bottom;
        float destinationY = Float.MIN_VALUE;

        if (imeVisible) {
            if (mStackPosition.y > maxBubbleY && mPreImeY == Float.MIN_VALUE) {
            if (mStackPosition.y > maxBubbleY && mPreImeY == Float.MIN_VALUE) {
                mPreImeY = mStackPosition.y;
                mPreImeY = mStackPosition.y;

                destinationY = maxBubbleY;
            springFirstBubbleWithStackFollowing(
            }
                    DynamicAnimation.TRANSLATION_Y,
        } else {
                    getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
            if (mPreImeY > Float.MIN_VALUE) {
                            .setStiffness(SpringForce.STIFFNESS_LOW),
                destinationY = mPreImeY;
                    /* startVel */ 0f,
                mPreImeY = Float.MIN_VALUE;
                    maxBubbleY);
            }
            }
        }
        }


    /**
        if (destinationY > Float.MIN_VALUE) {
     * Clear the IME height from the bounds and animate the stack back to its original position,
     * assuming it wasn't moved in the meantime.
     */
    public void updateBoundsForInvisibleImeAndAnimate() {
        mImeHeight = 0;

        if (mPreImeY > Float.MIN_VALUE) {
            springFirstBubbleWithStackFollowing(
            springFirstBubbleWithStackFollowing(
                    DynamicAnimation.TRANSLATION_Y,
                    DynamicAnimation.TRANSLATION_Y,
                    getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
                    getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
                            .setStiffness(SpringForce.STIFFNESS_LOW),
                            .setStiffness(SpringForce.STIFFNESS_LOW),
                    /* startVel */ 0f,
                    /* startVel */ 0f,
                    mPreImeY);
                    destinationY);
            mPreImeY = Float.MIN_VALUE;
        }
        }
    }
    }