summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/BubbleTextView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-07-25 17:08:38 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-07-25 17:34:09 -0700
commit8f8f398941e8ae36072dfaed4215bcb02ae84f88 (patch)
treec551f3aef584afa2c382cf6afa9832b563f3425a /src/com/android/launcher3/BubbleTextView.java
parent75df256cc14baf9e6b2d5f786cf06b56b0c800be (diff)
downloadandroid_packages_apps_Trebuchet-8f8f398941e8ae36072dfaed4215bcb02ae84f88.tar.gz
android_packages_apps_Trebuchet-8f8f398941e8ae36072dfaed4215bcb02ae84f88.tar.bz2
android_packages_apps_Trebuchet-8f8f398941e8ae36072dfaed4215bcb02ae84f88.zip
Adjusting the text shadows
Bug: 30192204 Change-Id: I4a12246521c41146b801f326a3d37e88aa49b727
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r--src/com/android/launcher3/BubbleTextView.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index c0c6673ee..b476392b4 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -56,11 +56,12 @@ public class BubbleTextView extends TextView
private static SparseArray<Theme> sPreloaderThemes = new SparseArray<Theme>(2);
- private static final float SHADOW_LARGE_RADIUS = 4.0f;
- private static final float SHADOW_SMALL_RADIUS = 1.75f;
- private static final float SHADOW_Y_OFFSET = 2.0f;
- private static final int SHADOW_LARGE_COLOUR = 0xDD000000;
- private static final int SHADOW_SMALL_COLOUR = 0xCC000000;
+ // Dimensions in DP
+ private static final float AMBIENT_SHADOW_RADIUS = 2.5f;
+ private static final float KEY_SHADOW_RADIUS = 1f;
+ private static final float KEY_SHADOW_OFFSET = 0.5f;
+ private static final int AMBIENT_SHADOW_COLOR = 0x33000000;
+ private static final int KEY_SHADOW_COLOR = 0x66000000;
private static final int DISPLAY_WORKSPACE = 0;
private static final int DISPLAY_ALL_APPS = 1;
@@ -136,6 +137,10 @@ public class BubbleTextView extends TextView
// Draw the background itself as the parent is drawn twice.
mBackground = getBackground();
setBackground(null);
+
+ // Set shadow layer as the larger shadow to that the textView does not clip the shadow.
+ float density = getResources().getDisplayMetrics().density;
+ setShadowLayer(density * AMBIENT_SHADOW_RADIUS, 0, 0, AMBIENT_SHADOW_COLOR);
} else {
mBackground = null;
}
@@ -144,10 +149,6 @@ public class BubbleTextView extends TextView
mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
mOutlineHelper = HolographicOutlineHelper.obtain(getContext());
- if (mCustomShadowsEnabled) {
- setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
- }
-
setAccessibilityDelegate(mLauncher.getAccessibilityDelegate());
}
@@ -408,13 +409,15 @@ public class BubbleTextView extends TextView
}
// We enhance the shadow by drawing the shadow twice
- getPaint().setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
+ float density = getResources().getDisplayMetrics().density;
+ getPaint().setShadowLayer(density * AMBIENT_SHADOW_RADIUS, 0, 0, AMBIENT_SHADOW_COLOR);
super.draw(canvas);
canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipRect(getScrollX(), getScrollY() + getExtendedPaddingTop(),
getScrollX() + getWidth(),
getScrollY() + getHeight(), Region.Op.INTERSECT);
- getPaint().setShadowLayer(SHADOW_SMALL_RADIUS, 0.0f, 0.0f, SHADOW_SMALL_COLOUR);
+ getPaint().setShadowLayer(
+ density * KEY_SHADOW_RADIUS, 0.0f, density * KEY_SHADOW_OFFSET, KEY_SHADOW_COLOR);
super.draw(canvas);
canvas.restore();
}