Bug 1320605 - The shrunk height just nee to cover the text itself. r=sebastian, a=jcristau
authorNevin Chen <cnevinchen@gmail.com>
Fri, 02 Dec 2016 11:12:24 +0800
changeset 353208 6180973a5211b531834d76b435f82d294932d329
parent 353207 a571b48128eb5d3e44ff44655c3ce5b34eed42f7
child 353209 1ece17e26bee22710a98ff2ea2e844763ac5a7dc
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, jcristau
bugs1320605
milestone52.0a2
Bug 1320605 - The shrunk height just nee to cover the text itself. r=sebastian, a=jcristau 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);