From 6f9f1d4b3b9f9844dc294758398f87cc7aa934b0 Mon Sep 17 00:00:00 2001 From: Igor Viarheichyk Date: Thu, 11 Sep 2014 15:07:05 -0700 Subject: [PATCH] Use constants instead of resources for ellipsis. All supported locales use only U+2025 and U+2026 to represent ellipses, and it will unlikely change in future. Given translated resources are inconsistent and often use three dots it is safer to use constants instead of resources. (cherry-pick of ed0daa93e48d38e54a7ad1c99c461510a4c07599.) Bug: 18542179 Change-Id: I51a6cb903f62f739fbadd6b78e5765c0028d641a --- core/java/android/text/TextUtils.java | 9 +++------ core/res/res/values/strings.xml | 8 -------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index 3502b52550f2d..8a8c6d8ec9d05 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -63,6 +63,8 @@ import java.util.regex.Pattern; public class TextUtils { private static final String TAG = "TextUtils"; + private static final String ELLIPSIS = new String(Layout.ELLIPSIS_NORMAL); + private static final String ELLIPSIS_TWO_DOTS = new String(Layout.ELLIPSIS_TWO_DOTS); private TextUtils() { /* cannot be instantiated */ } @@ -1081,14 +1083,9 @@ public class TextUtils { float avail, TruncateAt where, boolean preserveLength, EllipsizeCallback callback) { - - final String ellipsis = (where == TruncateAt.END_SMALL) ? - Resources.getSystem().getString(R.string.ellipsis_two_dots) : - Resources.getSystem().getString(R.string.ellipsis); - return ellipsize(text, paint, avail, where, preserveLength, callback, TextDirectionHeuristics.FIRSTSTRONG_LTR, - ellipsis); + (where == TruncateAt.END_SMALL) ? ELLIPSIS_TWO_DOTS : ELLIPSIS); } /** diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 0d76c25bd94df..20b4b62f3e808 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -82,14 +82,6 @@ for a note with no name. --> <Untitled> - - \u2026 - - - \u2025 - (No phone number)