From f3e64101bb2af1159518259229d5d429f8915787 Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Tue, 31 Jul 2012 13:39:06 -0700 Subject: [PATCH] Fix bug #6908329 TextUtils.ellipsize does not work properly when Locale is changed - load the ellipis resources on the fly to get the correct ones depending on the Locale Change-Id: I42d591e3f5ed715c983f736f94a80143a3897f47 --- core/java/android/text/TextUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index 270624cbfb179..83a70f3fce0d0 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -1042,9 +1042,14 @@ 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, - (where == TruncateAt.END_SMALL) ? ELLIPSIS_TWO_DOTS : ELLIPSIS_NORMAL); + ellipsis); } /** @@ -1700,9 +1705,4 @@ public class TextUtils { private static String[] EMPTY_STRING_ARRAY = new String[]{}; private static final char ZWNBS_CHAR = '\uFEFF'; - - private static final String ELLIPSIS_NORMAL = Resources.getSystem().getString( - R.string.ellipsis); - private static final String ELLIPSIS_TWO_DOTS = Resources.getSystem().getString( - R.string.ellipsis_two_dots); }