summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2015-04-10 03:35:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-10 03:35:32 +0000
commit7f9be1cbfaafe9f92f3c073a7b48bbfaa12230ba (patch)
tree56f3a3bd57eb8b13cd4ef25bc37bd63e7d611ecd /core/java/android
parentcb0392fa1c9b95a97d3bf7b78c6ba41afff2cff1 (diff)
parenteaddec8c7037e40f68863fe2bc9bc95401b284c0 (diff)
downloadframeworks_base-7f9be1cbfaafe9f92f3c073a7b48bbfaa12230ba.zip
frameworks_base-7f9be1cbfaafe9f92f3c073a7b48bbfaa12230ba.tar.gz
frameworks_base-7f9be1cbfaafe9f92f3c073a7b48bbfaa12230ba.tar.bz2
Merge "Use TextView's text locale for capitalization."
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/text/method/AllCapsTransformationMethod.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/core/java/android/text/method/AllCapsTransformationMethod.java b/core/java/android/text/method/AllCapsTransformationMethod.java
index f9920dd..0cea821 100644
--- a/core/java/android/text/method/AllCapsTransformationMethod.java
+++ b/core/java/android/text/method/AllCapsTransformationMethod.java
@@ -19,6 +19,7 @@ import android.content.Context;
import android.graphics.Rect;
import android.util.Log;
import android.view.View;
+import android.widget.TextView;
import java.util.Locale;
@@ -39,11 +40,23 @@ public class AllCapsTransformationMethod implements TransformationMethod2 {
@Override
public CharSequence getTransformation(CharSequence source, View view) {
- if (mEnabled) {
- return source != null ? source.toString().toUpperCase(mLocale) : null;
+ if (!mEnabled) {
+ Log.w(TAG, "Caller did not enable length changes; not transforming text");
+ return source;
}
- Log.w(TAG, "Caller did not enable length changes; not transforming text");
- return source;
+
+ if (source == null) {
+ return null;
+ }
+
+ Locale locale = null;
+ if (view instanceof TextView) {
+ locale = ((TextView)view).getTextLocale();
+ }
+ if (locale == null) {
+ locale = mLocale;
+ }
+ return source.toString().toUpperCase(locale);
}
@Override