Merge "Update app icon shadows" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2b6700a94c
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.launcher3.views;
|
||||
|
||||
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
@@ -56,11 +54,10 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
super.onDraw(canvas);
|
||||
return;
|
||||
}
|
||||
int alpha = Color.alpha(getCurrentTextColor());
|
||||
|
||||
// We enhance the shadow by drawing the shadow twice
|
||||
getPaint().setShadowLayer(mShadowInfo.ambientShadowBlur, 0, 0,
|
||||
getTextShadowColor(mShadowInfo.ambientShadowColor, alpha));
|
||||
mShadowInfo.ambientShadowColor);
|
||||
|
||||
drawWithoutDot(canvas);
|
||||
canvas.save();
|
||||
@@ -72,7 +69,7 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
mShadowInfo.keyShadowBlur,
|
||||
mShadowInfo.keyShadowOffsetX,
|
||||
mShadowInfo.keyShadowOffsetY,
|
||||
getTextShadowColor(mShadowInfo.keyShadowColor, alpha));
|
||||
mShadowInfo.keyShadowColor);
|
||||
drawWithoutDot(canvas);
|
||||
canvas.restore();
|
||||
|
||||
@@ -113,24 +110,18 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
return true;
|
||||
} else if (ambientShadowAlpha > 0 && keyShadowAlpha == 0) {
|
||||
textView.getPaint().setShadowLayer(ambientShadowBlur, 0, 0,
|
||||
getTextShadowColor(ambientShadowColor, textAlpha));
|
||||
ambientShadowColor);
|
||||
return true;
|
||||
} else if (keyShadowAlpha > 0 && ambientShadowAlpha == 0) {
|
||||
textView.getPaint().setShadowLayer(
|
||||
keyShadowBlur,
|
||||
keyShadowOffsetX,
|
||||
keyShadowOffsetY,
|
||||
getTextShadowColor(keyShadowColor, textAlpha));
|
||||
keyShadowColor);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplies the alpha of shadowColor by textAlpha.
|
||||
private static int getTextShadowColor(int shadowColor, int textAlpha) {
|
||||
return setColorAlphaBound(shadowColor,
|
||||
Math.round(Color.alpha(shadowColor) * textAlpha / 255f));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user