Fixed a flickering of the icon when it goes into the shelf

We can adjust the Pivot such that the scaling doesn't happen
irregularly and that the animation is smooth.

Change-Id: Ib2e42a20430e1c10950a197a4c04e7c64c7dec67
Test: add notification, no flicker
Fixes: 80270979
This commit is contained in:
Selim Cinek
2018-06-08 00:26:48 -07:00
parent d54c3a3036
commit 3ddda6dc4c

View File

@@ -197,6 +197,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
mDarkAmount);
final int outerBounds = mStatusBarIconSize;
mIconScale = (float)imageBounds / (float)outerBounds;
updatePivot();
}
private void updateIconScaleForSystemIcons() {
@@ -859,6 +860,12 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
mLayoutRunnable.run();
mLayoutRunnable = null;
}
updatePivot();
}
private void updatePivot() {
setPivotX((1 - mIconScale) / 2.0f * getWidth());
setPivotY((getHeight() - mIconScale * getWidth()) / 2.0f);
}
public void executeOnLayout(Runnable runnable) {