Use selected shape during app launch animation
Bug: 372906633
Flag: com.android.launcher3.enable_launcher_icon_shapes
Test: manually launching apps
Change-Id: I86879e51df95b791266e9a5678042859a3fb27f0
diff --git a/src/com/android/launcher3/views/ClipIconView.java b/src/com/android/launcher3/views/ClipIconView.java
index ddf18df..e80aa33 100644
--- a/src/com/android/launcher3/views/ClipIconView.java
+++ b/src/com/android/launcher3/views/ClipIconView.java
@@ -44,6 +44,7 @@
import androidx.core.util.Consumer;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.Flags;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
@@ -68,6 +69,7 @@
private boolean mIsAdaptiveIcon = false;
private ValueAnimator mRevealAnimator;
+ private float mIconScale;
private final Rect mStartRevealRect = new Rect();
private final Rect mEndRevealRect = new Rect();
@@ -173,9 +175,12 @@
mTaskCornerRadius = cornerRadius / scale;
if (mIsAdaptiveIcon) {
- if (!isOpening && progress >= shapeProgressStart) {
+ final ThemeManager themeManager = ThemeManager.INSTANCE.get(getContext());
+ mIconScale = themeManager.getIconState().getIconScale();
+ if ((!isOpening || Flags.enableLauncherIconShapes())
+ && progress >= shapeProgressStart) {
if (mRevealAnimator == null) {
- mRevealAnimator = ThemeManager.INSTANCE.get(getContext()).getIconShape()
+ mRevealAnimator = themeManager.getIconShape()
.createRevealAnimator(this, mStartRevealRect,
mOutline, mTaskCornerRadius, !isOpening);
mRevealAnimator.addListener(forEndCallback(() -> mRevealAnimator = null));
@@ -310,17 +315,24 @@
@Override
public void draw(Canvas canvas) {
- int count = canvas.save();
+ int count1 = canvas.save();
if (mClipPath != null) {
canvas.clipPath(mClipPath);
}
- super.draw(canvas);
+ int count2 = canvas.save();
+ float iconCenterX =
+ (mFinalDrawableBounds.right - mFinalDrawableBounds.left) / 2f * mIconScale;
+ float iconCenterY =
+ (mFinalDrawableBounds.bottom - mFinalDrawableBounds.top) / 2f * mIconScale;
+ canvas.scale(mIconScale, mIconScale, iconCenterX, iconCenterY);
if (mBackground != null) {
mBackground.draw(canvas);
}
if (mForeground != null) {
mForeground.draw(canvas);
}
+ canvas.restoreToCount(count2);
+ super.draw(canvas);
if (mTaskViewArtist != null) {
canvas.saveLayerAlpha(
0,
@@ -334,7 +346,7 @@
canvas.scale(drawScale, drawScale);
mTaskViewArtist.taskViewDrawCallback.accept(canvas);
}
- canvas.restoreToCount(count);
+ canvas.restoreToCount(count1);
}
void recycle() {