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 325405 594afa97ff78d3f2814f3710719b32b25b1640e9
parent 325372 c0c81b07657019357731bcbd7238ca77290371c9
child 325406 a5c688e01e3bc636ae93c1e64944e3c829073180
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerssebastian
bugs1320605
milestone53.0a1
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);