Bug 1320605 - The shrunk height just nee to cover the text itself. r=sebastian draft
authorNevin Chen <cnevinchen@gmail.com>
Fri, 02 Dec 2016 11:12:24 +0800
changeset 447749 a0f3825fe32e1d9823edc25b135d62b025da0bde
parent 446144 27449c736a04eec8c9033d70697747fce3a3c13d
child 539105 d77578dc86d3ab187363cf82a744db0a2c2d9b12
push id38143
push userbmo:cnevinchen@gmail.com
push dateWed, 07 Dec 2016 13:06:57 +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);