mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
Merge "Updated launcher text shadow values." into sc-dev am: 64fc7543f0
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14204932 Change-Id: I8a0dbe2491a07d5e884462c1941225b961df1ec5
This commit is contained in:
@@ -80,7 +80,8 @@
|
||||
<attr name="ambientShadowBlur" format="dimension" />
|
||||
<attr name="keyShadowColor" format="color" />
|
||||
<attr name="keyShadowBlur" format="dimension" />
|
||||
<attr name="keyShadowOffset" format="dimension" />
|
||||
<attr name="keyShadowOffsetX" format="dimension" />
|
||||
<attr name="keyShadowOffsetY" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- PagedView specific attributes. These attributes are used to customize
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
<item name="isWorkspaceDarkText">false</item>
|
||||
<item name="workspaceTextColor">@color/workspace_text_color_light</item>
|
||||
<item name="workspaceShadowColor">#B0000000</item>
|
||||
<item name="workspaceAmbientShadowColor">#33000000</item>
|
||||
<item name="workspaceKeyShadowColor">#44000000</item>
|
||||
<item name="workspaceAmbientShadowColor">#00000000</item>
|
||||
<item name="workspaceKeyShadowColor">#89000000</item>
|
||||
<item name="workspaceStatusBarScrim">@drawable/workspace_bg</item>
|
||||
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
|
||||
<item name="folderDotColor">?android:attr/colorPrimary</item>
|
||||
@@ -243,8 +243,9 @@
|
||||
<item name="ambientShadowColor">?attr/workspaceAmbientShadowColor</item>
|
||||
<item name="ambientShadowBlur">2.5dp</item>
|
||||
<item name="keyShadowColor">?attr/workspaceKeyShadowColor</item>
|
||||
<item name="keyShadowBlur">1dp</item>
|
||||
<item name="keyShadowOffset">.5dp</item>
|
||||
<item name="keyShadowBlur">.5dp</item>
|
||||
<item name="keyShadowOffsetX">.5dp</item>
|
||||
<item name="keyShadowOffsetY">.5dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme for the popup container -->
|
||||
|
||||
@@ -60,7 +60,7 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
|
||||
// We enhance the shadow by drawing the shadow twice
|
||||
getPaint().setShadowLayer(mShadowInfo.ambientShadowBlur, 0, 0,
|
||||
setColorAlphaBound(mShadowInfo.ambientShadowColor, alpha));
|
||||
getTextShadowColor(mShadowInfo.ambientShadowColor, alpha));
|
||||
|
||||
drawWithoutDot(canvas);
|
||||
canvas.save();
|
||||
@@ -68,8 +68,11 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
getScrollX() + getWidth(),
|
||||
getScrollY() + getHeight());
|
||||
|
||||
getPaint().setShadowLayer(mShadowInfo.keyShadowBlur, 0.0f, mShadowInfo.keyShadowOffset,
|
||||
setColorAlphaBound(mShadowInfo.keyShadowColor, alpha));
|
||||
getPaint().setShadowLayer(
|
||||
mShadowInfo.keyShadowBlur,
|
||||
mShadowInfo.keyShadowOffsetX,
|
||||
mShadowInfo.keyShadowOffsetY,
|
||||
getTextShadowColor(mShadowInfo.keyShadowColor, alpha));
|
||||
drawWithoutDot(canvas);
|
||||
canvas.restore();
|
||||
|
||||
@@ -81,7 +84,8 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
public final int ambientShadowColor;
|
||||
|
||||
public final float keyShadowBlur;
|
||||
public final float keyShadowOffset;
|
||||
public final float keyShadowOffsetX;
|
||||
public final float keyShadowOffsetY;
|
||||
public final int keyShadowColor;
|
||||
|
||||
public ShadowInfo(Context c, AttributeSet attrs, int defStyle) {
|
||||
@@ -89,11 +93,13 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
TypedArray a = c.obtainStyledAttributes(
|
||||
attrs, R.styleable.ShadowInfo, defStyle, 0);
|
||||
|
||||
ambientShadowBlur = a.getDimension(R.styleable.ShadowInfo_ambientShadowBlur, 0);
|
||||
ambientShadowBlur = a.getDimensionPixelSize(
|
||||
R.styleable.ShadowInfo_ambientShadowBlur, 0);
|
||||
ambientShadowColor = a.getColor(R.styleable.ShadowInfo_ambientShadowColor, 0);
|
||||
|
||||
keyShadowBlur = a.getDimension(R.styleable.ShadowInfo_keyShadowBlur, 0);
|
||||
keyShadowOffset = a.getDimension(R.styleable.ShadowInfo_keyShadowOffset, 0);
|
||||
keyShadowBlur = a.getDimensionPixelSize(R.styleable.ShadowInfo_keyShadowBlur, 0);
|
||||
keyShadowOffsetX = a.getDimensionPixelSize(R.styleable.ShadowInfo_keyShadowOffsetX, 0);
|
||||
keyShadowOffsetY = a.getDimensionPixelSize(R.styleable.ShadowInfo_keyShadowOffsetY, 0);
|
||||
keyShadowColor = a.getColor(R.styleable.ShadowInfo_keyShadowColor, 0);
|
||||
a.recycle();
|
||||
}
|
||||
@@ -105,17 +111,26 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
if (textAlpha == 0 || (keyShadowAlpha == 0 && ambientShadowAlpha == 0)) {
|
||||
textView.getPaint().clearShadowLayer();
|
||||
return true;
|
||||
} else if (ambientShadowAlpha > 0) {
|
||||
} else if (ambientShadowAlpha > 0 && keyShadowAlpha == 0) {
|
||||
textView.getPaint().setShadowLayer(ambientShadowBlur, 0, 0,
|
||||
setColorAlphaBound(ambientShadowColor, textAlpha));
|
||||
getTextShadowColor(ambientShadowColor, textAlpha));
|
||||
return true;
|
||||
} else if (keyShadowAlpha > 0) {
|
||||
textView.getPaint().setShadowLayer(keyShadowBlur, 0.0f, keyShadowOffset,
|
||||
setColorAlphaBound(keyShadowColor, textAlpha));
|
||||
} else if (keyShadowAlpha > 0 && ambientShadowAlpha == 0) {
|
||||
textView.getPaint().setShadowLayer(
|
||||
keyShadowBlur,
|
||||
keyShadowOffsetX,
|
||||
keyShadowOffsetY,
|
||||
getTextShadowColor(keyShadowColor, textAlpha));
|
||||
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