Merge "Remove shadow on folder icon." into sc-dev am: 6bb0844766

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14315610

Change-Id: Ie566e284c3366d31347f5b7f154adce6fdcd08a2
This commit is contained in:
TreeHugger Robot
2021-04-28 15:28:47 +00:00
committed by Automerger Merge Worker
@@ -50,6 +50,8 @@ import com.android.launcher3.views.ActivityContext;
*/ */
public class PreviewBackground extends CellLayout.DelegatedCellDrawing { public class PreviewBackground extends CellLayout.DelegatedCellDrawing {
private static final boolean DRAW_SHADOW = false;
private static final int CONSUMPTION_ANIMATION_DURATION = 100; private static final int CONSUMPTION_ANIMATION_DURATION = 100;
private final PorterDuffXfermode mShadowPorterDuffXfermode private final PorterDuffXfermode mShadowPorterDuffXfermode
@@ -163,13 +165,15 @@ public class PreviewBackground extends CellLayout.DelegatedCellDrawing {
// Stroke width is 1dp // Stroke width is 1dp
mStrokeWidth = context.getResources().getDisplayMetrics().density; mStrokeWidth = context.getResources().getDisplayMetrics().density;
float radius = getScaledRadius(); if (DRAW_SHADOW) {
float shadowRadius = radius + mStrokeWidth; float radius = getScaledRadius();
int shadowColor = Color.argb(SHADOW_OPACITY, 0, 0, 0); float shadowRadius = radius + mStrokeWidth;
mShadowShader = new RadialGradient(0, 0, 1, int shadowColor = Color.argb(SHADOW_OPACITY, 0, 0, 0);
new int[] {shadowColor, Color.TRANSPARENT}, mShadowShader = new RadialGradient(0, 0, 1,
new float[] {radius / shadowRadius, 1}, new int[]{shadowColor, Color.TRANSPARENT},
Shader.TileMode.CLAMP); new float[]{radius / shadowRadius, 1},
Shader.TileMode.CLAMP);
}
invalidate(); invalidate();
} }
@@ -239,6 +243,9 @@ public class PreviewBackground extends CellLayout.DelegatedCellDrawing {
} }
public void drawShadow(Canvas canvas) { public void drawShadow(Canvas canvas) {
if (!DRAW_SHADOW) {
return;
}
if (mShadowShader == null) { if (mShadowShader == null) {
return; return;
} }
@@ -277,6 +284,9 @@ public class PreviewBackground extends CellLayout.DelegatedCellDrawing {
} }
public void fadeInBackgroundShadow() { public void fadeInBackgroundShadow() {
if (!DRAW_SHADOW) {
return;
}
if (mShadowAnimator != null) { if (mShadowAnimator != null) {
mShadowAnimator.cancel(); mShadowAnimator.cancel();
} }