Bug 1320605 - The shrunk height just nee to cover the text itself. r=sebastian
authorNevin Chen <cnevinchen@gmail.com>
Fri, 02 Dec 2016 11:12:24 +0800
changeset 325372 594afa97ff78d3f2814f3710719b32b25b1640e9
parent 325339 c0c81b07657019357731bcbd7238ca77290371c9
child 325373 a5c688e01e3bc636ae93c1e64944e3c829073180
push id31053
push usercbook@mozilla.com
push dateFri, 09 Dec 2016 12:31:17 +0000
treeherdermozilla-central@88e0fb654a10 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1320605
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1320605 - The shrunk height just nee to cover the text itself. r=sebastian MozReview-Commit-ID: BdoLEOKjvxw
mobile/android/base/java/org/mozilla/gecko/widget/FadedMultiColorTextView.java
--- a/mobile/android/base/java/org/mozilla/gecko/widget/FadedMultiColorTextView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/FadedMultiColorTextView.java
@@ -52,18 +52,19 @@ public class FadedMultiColorTextView ext
             final int right = getWidth() - getCompoundPaddingRight();
             final float left = right - fadeWidth;
 
             updateGradientShader(needsEllipsis, right);
 
             final float center = getHeight() / 2;
 
             // Shrink height of gradient to prevent it overlaying parent view border.
-            final float top = center - getTextSize() + 2;
-            final float bottom = center + getTextSize() - 2;
+            // The shrunk size just nee to cover the text itself.
+            final float top = center - getTextSize() / 2;
+            final float bottom = center + getTextSize() / 2;
 
             canvas.drawRect(left, top, right, bottom, fadePaint);
         }
     }
 
     private void updateGradientShader(final boolean needsEllipsis, final int gradientEndRight) {
         final int backgroundColor =
                 fadeBackgroundColorList.getColorForState(getDrawableState(), Color.RED);