summaryrefslogtreecommitdiff
path: root/core/java/android/text/StaticLayout.java
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2011-09-23 19:08:04 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2011-09-25 14:39:27 -0700
commitcb332649e44db86ff8b4e7f006db4bbfd82fed55 (patch)
tree968c9bac12944d762e47f7dcc5813198f02c4176 /core/java/android/text/StaticLayout.java
parent4c253119db0ce753e46ec3809b54b9e357d363db (diff)
Fix bug #5366547 TruncateAt.MARQUEE should be replaces with "two dot" ellipsis on hardware that dont support MARQUEE
- introduce TruncateAt.END_SMALL - code refactoring for suppressing use of hardcoded constants Change-Id: I70e24857cd5d6bd012a743cbc0ba46fbd06d5457
Diffstat (limited to 'core/java/android/text/StaticLayout.java')
-rw-r--r--core/java/android/text/StaticLayout.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java
index e8b2045ef828..583cbe615fa4 100644
--- a/core/java/android/text/StaticLayout.java
+++ b/core/java/android/text/StaticLayout.java
@@ -763,7 +763,8 @@ public class StaticLayout extends Layout {
return;
}
- float ellipsisWidth = paint.measureText(HORIZONTAL_ELLIPSIS);
+ float ellipsisWidth = paint.measureText(
+ (where == TextUtils.TruncateAt.END_SMALL) ? ELLIPSIS_TWO_DOTS : ELLIPSIS_NORMAL);
int ellipsisStart = 0;
int ellipsisCount = 0;
int len = lineEnd - lineStart;
@@ -791,7 +792,8 @@ public class StaticLayout extends Layout {
Log.w(TAG, "Start Ellipsis only supported with one line");
}
}
- } else if (where == TextUtils.TruncateAt.END || where == TextUtils.TruncateAt.MARQUEE) {
+ } else if (where == TextUtils.TruncateAt.END || where == TextUtils.TruncateAt.MARQUEE ||
+ where == TextUtils.TruncateAt.END_SMALL) {
float sum = 0;
int i;
@@ -1001,7 +1003,9 @@ public class StaticLayout extends Layout {
private static final char CHAR_HYPHEN = '-';
private static final double EXTRA_ROUNDING = 0.5;
- private static final String HORIZONTAL_ELLIPSIS = "\u2026"; // this is "..."
+
+ private static final String ELLIPSIS_NORMAL = "\u2026"; // this is "..."
+ private static final String ELLIPSIS_TWO_DOTS = "\u2025"; // this is ".."
private static final int CHAR_FIRST_HIGH_SURROGATE = 0xD800;
private static final int CHAR_LAST_LOW_SURROGATE = 0xDFFF;