diff options
| author | 2015-04-09 21:57:20 +0900 | |
|---|---|---|
| committer | 2015-04-09 21:57:20 +0900 | |
| commit | eaddec8c7037e40f68863fe2bc9bc95401b284c0 (patch) | |
| tree | bc349a19224b234a026443c961c29f2ee6938a75 | |
| parent | 7a11a0e8c1bf452de0516b675b0180f63d9c5c5d (diff) | |
Use TextView's text locale for capitalization.
BUG: 19284889
Change-Id: Icd3c1dd3b31c23025bc974bcbb5a3618196434e7
| -rw-r--r-- | core/java/android/text/method/AllCapsTransformationMethod.java | 21 |
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 f9920dd2e275..0cea82114a77 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 |