diff options
| author | Raph Levien <raph@google.com> | 2013-09-26 23:31:48 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-26 23:31:49 +0000 |
| commit | adf149029f701464c66cc5cacbbbc649c1319bcd (patch) | |
| tree | d94b26677841082c04049a1fc5c0a44bece189ee /core/java/android/widget/TextView.java | |
| parent | aaf0f83c69efd004420633fb577443de80eb35d6 (diff) | |
| parent | 8079ae1a2da32b2720bb14ab9957cc80d77bc139 (diff) | |
Merge "Fix for Text fading on RTL app names is done at the beginning..." into klp-dev
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index ae1b6279609d..97cb815337c4 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -7838,7 +7838,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener getCompoundPaddingLeft() - getCompoundPaddingRight() - mLayout.getLineLeft(0)) / getHorizontalFadingEdgeLength(); case Gravity.CENTER_HORIZONTAL: - return 0.0f; + case Gravity.FILL_HORIZONTAL: + final int textDirection = mLayout.getParagraphDirection(0); + if (textDirection == Layout.DIR_LEFT_TO_RIGHT) { + return 0.0f; + } else { + return (mLayout.getLineRight(0) - (mRight - mLeft) - + getCompoundPaddingLeft() - getCompoundPaddingRight() - + mLayout.getLineLeft(0)) / getHorizontalFadingEdgeLength(); + } } } } @@ -7867,9 +7875,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return 0.0f; case Gravity.CENTER_HORIZONTAL: case Gravity.FILL_HORIZONTAL: - return (mLayout.getLineWidth(0) - ((mRight - mLeft) - + final int textDirection = mLayout.getParagraphDirection(0); + if (textDirection == Layout.DIR_RIGHT_TO_LEFT) { + return 0.0f; + } else { + return (mLayout.getLineWidth(0) - ((mRight - mLeft) - getCompoundPaddingLeft() - getCompoundPaddingRight())) / getHorizontalFadingEdgeLength(); + } } } } |
