Merge "[Overview Sharing] Turn on the feature flag for overview sharing." into sc-dev
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 9089a64..93d88c2 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -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
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 8d46f1c..5ae4e3f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -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 -->
diff --git a/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java b/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java
index d89e7f8..a309e6e 100644
--- a/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java
+++ b/src/com/android/launcher3/views/DoubleShadowBubbleTextView.java
@@ -60,7 +60,7 @@
// 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 @@
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 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 @@
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 @@
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));
+ }
}