From 15872dad931963a763598ba3fd3b3480efc56f75 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 8 Jul 2014 15:43:54 -0700 Subject: [PATCH] Fixing background being drawn multiple times for BubbleTextView issue 16160873 Change-Id: Ic04d54dd6541e352bf543d8acb2452ea6e0567da --- src/com/android/launcher3/BubbleTextView.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 54d7e506ea..57dcea0444 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -66,11 +66,11 @@ public class BubbleTextView extends TextView { private float mSlop; private int mTextColor; - private boolean mCustomShadowsEnabled = true; + private final boolean mCustomShadowsEnabled; private boolean mIsTextVisible; private boolean mBackgroundSizeChanged; - private Drawable mBackground; + private final Drawable mBackground; private boolean mStayPressed; private CheckLongPressHelper mLongPressHelper; @@ -96,6 +96,13 @@ public class BubbleTextView extends TextView { mCustomShadowsEnabled = a.getBoolean(R.styleable.BubbleTextView_customShadows, true); a.recycle(); + if (mCustomShadowsEnabled) { + // Draw the background itself as the parent is drawn twice. + mBackground = getBackground(); + setBackground(null); + } else { + mBackground = null; + } init(); } @@ -110,7 +117,6 @@ public class BubbleTextView extends TextView { private void init() { mLongPressHelper = new CheckLongPressHelper(this); - mBackground = getBackground(); mOutlineHelper = HolographicOutlineHelper.obtain(getContext()); if (mCustomShadowsEnabled) {