Animate the long press icon scale for task menu to match task view

Use scale listeners to track each other's icon scale to match them.

Test: go to recents and long press icon
Fixes: 110789415
Change-Id: I9bba3130ecf1d099db9708c84e709d16f5906c36
This commit is contained in:
Matthew Ng
2018-06-25 15:32:24 -07:00
parent 1f8cbcf1c6
commit eb9cc9dbd5
4 changed files with 115 additions and 14 deletions

View File

@@ -109,7 +109,7 @@ public class FastBitmapDrawable extends Drawable {
@Override
public final void draw(Canvas canvas) {
if (mScaleAnimation != null) {
if (mScale != 1f) {
int count = canvas.save();
Rect bounds = getBounds();
canvas.scale(mScale, mScale, bounds.exactCenterX(), bounds.exactCenterY());
@@ -150,10 +150,23 @@ public class FastBitmapDrawable extends Drawable {
return mAlpha;
}
public void setScale(float scale) {
if (mScaleAnimation != null) {
mScaleAnimation.cancel();
mScaleAnimation = null;
}
mScale = scale;
invalidateSelf();
}
public float getAnimatedScale() {
return mScaleAnimation == null ? 1 : mScale;
}
public float getScale() {
return mScale;
}
@Override
public int getIntrinsicWidth() {
return mBitmap.getWidth();