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

Commit f31efa38 authored by George Mount's avatar George Mount
Browse files

Ensure bounds are updated together.

Bug 37156683

The animator was setting the value twice on the first run, so
the bounds was being set improperly as the top/left was being
set from a different frame than the bottom/right.

Test: I534cc4d7534cff1206ea8c2b222e0c0852fc0e9c
Change-Id: I6fb047d2fa4d0ed0db3b44107f9815a65f1f2676
parent 91d28990
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -472,9 +472,9 @@ public class ChangeBounds extends Transition {
        private int mTop;
        private int mRight;
        private int mBottom;
        private boolean mIsTopLeftSet;
        private boolean mIsBottomRightSet;
        private View mView;
        private int mTopLeftCalls;
        private int mBottomRightCalls;

        public ViewBounds(View view) {
            mView = view;
@@ -483,8 +483,8 @@ public class ChangeBounds extends Transition {
        public void setTopLeft(PointF topLeft) {
            mLeft = Math.round(topLeft.x);
            mTop = Math.round(topLeft.y);
            mIsTopLeftSet = true;
            if (mIsBottomRightSet) {
            mTopLeftCalls++;
            if (mTopLeftCalls == mBottomRightCalls) {
                setLeftTopRightBottom();
            }
        }
@@ -492,16 +492,16 @@ public class ChangeBounds extends Transition {
        public void setBottomRight(PointF bottomRight) {
            mRight = Math.round(bottomRight.x);
            mBottom = Math.round(bottomRight.y);
            mIsBottomRightSet = true;
            if (mIsTopLeftSet) {
            mBottomRightCalls++;
            if (mTopLeftCalls == mBottomRightCalls) {
                setLeftTopRightBottom();
            }
        }

        private void setLeftTopRightBottom() {
            mView.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
            mIsTopLeftSet = false;
            mIsBottomRightSet = false;
            mTopLeftCalls = 0;
            mBottomRightCalls = 0;
        }
    }
}