summaryrefslogtreecommitdiff
path: root/core/java/android/text/DynamicLayout.java
diff options
context:
space:
mode:
authorDoug Felt <dougfelt@google.com>2011-07-07 11:57:48 -0700
committerDoug Felt <dougfelt@google.com>2011-07-14 11:24:33 -0700
commitcb379120456d8065d742021fc5c66748fc8a11a8 (patch)
tree980cb4378ded06d096f8606073a2f32245f6df87 /core/java/android/text/DynamicLayout.java
parentad3f935ce9f3308edc62d56a0059e0761c720077 (diff)
Implement textDirection heuristic selection.
Change-Id: I2fcf18de573f2d66494fa5ed61e4273c3c6078c7
Diffstat (limited to 'core/java/android/text/DynamicLayout.java')
-rw-r--r--core/java/android/text/DynamicLayout.java31
1 files changed, 25 insertions, 6 deletions
diff --git a/core/java/android/text/DynamicLayout.java b/core/java/android/text/DynamicLayout.java
index f196b34ace4d..cb9696961cb9 100644
--- a/core/java/android/text/DynamicLayout.java
+++ b/core/java/android/text/DynamicLayout.java
@@ -75,12 +75,31 @@ extends Layout
float spacingmult, float spacingadd,
boolean includepad,
TextUtils.TruncateAt ellipsize, int ellipsizedWidth) {
- super((ellipsize == null)
- ? display
- : (display instanceof Spanned)
- ? new SpannedEllipsizer(display)
+ this(base, display, paint, width, align, TextDirectionHeuristics.FIRSTSTRONG_LTR,
+ spacingmult, spacingadd, includepad, ellipsize, ellipsizedWidth);
+ }
+
+ /**
+ * Make a layout for the transformed text (password transformation
+ * being the primary example of a transformation)
+ * that will be updated as the base text is changed.
+ * If ellipsize is non-null, the Layout will ellipsize the text
+ * down to ellipsizedWidth.
+ * *
+ * *@hide
+ */
+ public DynamicLayout(CharSequence base, CharSequence display,
+ TextPaint paint,
+ int width, Alignment align, TextDirectionHeuristic textDir,
+ float spacingmult, float spacingadd,
+ boolean includepad,
+ TextUtils.TruncateAt ellipsize, int ellipsizedWidth) {
+ super((ellipsize == null)
+ ? display
+ : (display instanceof Spanned)
+ ? new SpannedEllipsizer(display)
: new Ellipsizer(display),
- paint, width, align, spacingmult, spacingadd);
+ paint, width, align, textDir, spacingmult, spacingadd);
mBase = base;
mDisplay = display;
@@ -259,7 +278,7 @@ extends Layout
reflowed = new StaticLayout(true);
reflowed.generate(text, where, where + after,
- getPaint(), getWidth(), getAlignment(),
+ getPaint(), getWidth(), getAlignment(), getTextDirectionHeuristic(),
getSpacingMultiplier(), getSpacingAdd(),
false, true, mEllipsizedWidth, mEllipsizeAt);
int n = reflowed.getLineCount();