diff options
author | Michael Lekman <michael.lekman.x@sonyericsson.com> | 2012-01-11 14:27:52 +0100 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2014-03-25 18:03:34 +0000 |
commit | 89bc413b8f04a85dffd9c80fe497208357009c7b (patch) | |
tree | 601669a05b2b2591ea32428690a893f3e43ffaa1 /core | |
parent | 77ceb5e8f18608cdbf19831f6188db87a5e0c058 (diff) | |
download | frameworks_base-89bc413b8f04a85dffd9c80fe497208357009c7b.zip frameworks_base-89bc413b8f04a85dffd9c80fe497208357009c7b.tar.gz frameworks_base-89bc413b8f04a85dffd9c80fe497208357009c7b.tar.bz2 |
Marquee text RTL improvements
Changed marquee text to scroll according to
the reading direction. Arabic text will
show the right edge and scroll towards
the left edge and vice versa for Latin.
Corrected marquee flicker when scroll animation
finished. The ghost scroll's x position was cast
to int and it made the text flicker when
marquee stops.
Ghost part didn't display for RTL languages.
Added multiplication with
getParagraphDirection to negate the ghost
offset.
Change-Id: I689039118df01a62f73ef0079c857fea1bfcc5a0
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/TextView.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 7a9809f..3f35875 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -5147,12 +5147,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int width = mRight - mLeft; final int padding = getCompoundPaddingLeft() + getCompoundPaddingRight(); final float dx = mLayout.getLineRight(0) - (width - padding); - canvas.translate(isLayoutRtl ? -dx : +dx, 0.0f); + canvas.translate(layout.getParagraphDirection(0) * dx, 0.0f); } if (mMarquee != null && mMarquee.isRunning()) { final float dx = -mMarquee.getScroll(); - canvas.translate(isLayoutRtl ? -dx : +dx, 0.0f); + canvas.translate(layout.getParagraphDirection(0) * dx, 0.0f); } } @@ -5166,8 +5166,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } if (mMarquee != null && mMarquee.shouldDrawGhost()) { - final int dx = (int) mMarquee.getGhostOffset(); - canvas.translate(isLayoutRtl ? -dx : dx, 0.0f); + final float dx = mMarquee.getGhostOffset(); + canvas.translate(layout.getParagraphDirection(0) * dx, 0.0f); layout.draw(canvas, highlight, mHighlightPaint, cursorOffsetVertical); } |