mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user