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

Commit f9abe7bc authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Update rect in LiveTileOverlay via copying

Probably a recent change updates the rect when reaching overview, which wasn't happening before. Regardless, we shouldn't have copied the rect by reference since the referenced copy can be changed.

Fixes: 165143463
Test: manual
Change-Id: I9315a20226f0a4b3440ce5ee6cc1f4ed1ddca487
parent 532b962a
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -40,14 +40,13 @@ public class LiveTileOverlay extends Drawable {
    public static final LiveTileOverlay INSTANCE = new LiveTileOverlay();

    private final Paint mPaint = new Paint();
    private final RectF mCurrentRect = new RectF();
    private final Rect mBoundsRect = new Rect();

    private RectF mCurrentRect;
    private float mCornerRadius;
    private Drawable mIcon;
    private Animator mIconAnimator;

    private boolean mDrawEnabled = true;
    private float mIconAnimationProgress = 0f;
    private boolean mIsAttached;

@@ -58,7 +57,7 @@ public class LiveTileOverlay extends Drawable {
    public void update(RectF currentRect, float cornerRadius) {
        invalidateSelf();

        mCurrentRect = currentRect;
        mCurrentRect.set(currentRect);
        mCornerRadius = cornerRadius;

        mCurrentRect.roundOut(mBoundsRect);
@@ -93,16 +92,9 @@ public class LiveTileOverlay extends Drawable {
        return mIconAnimationProgress;
    }

    public void setDrawEnabled(boolean drawEnabled) {
        if (mDrawEnabled != drawEnabled) {
            mDrawEnabled = drawEnabled;
            invalidateSelf();
        }
    }

    @Override
    public void draw(Canvas canvas) {
        if (mCurrentRect != null && mDrawEnabled) {
        if (mCurrentRect != null) {
            canvas.drawRoundRect(mCurrentRect, mCornerRadius, mCornerRadius, mPaint);
            if (mIcon != null && mIconAnimationProgress > 0f) {
                canvas.save();