diff options
author | Raph Levien <raph@google.com> | 2015-01-15 17:27:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-01-15 17:27:56 +0000 |
commit | a239ef91e502c17fae8514fa6314f9d86f0c40f7 (patch) | |
tree | 681c873e54b79ef75efdd993302affac52b5bce0 /core/java | |
parent | 757882088f203280953d98596fc217f34fa45809 (diff) | |
parent | 2e3aa445b418e63f8c1bf7272fa2d75e021d7164 (diff) | |
download | frameworks_base-a239ef91e502c17fae8514fa6314f9d86f0c40f7.zip frameworks_base-a239ef91e502c17fae8514fa6314f9d86f0c40f7.tar.gz frameworks_base-a239ef91e502c17fae8514fa6314f9d86f0c40f7.tar.bz2 |
Merge "Track TextView locale changes if not explicitly set"
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/widget/TextView.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 92ca427..6d3b063 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -25,6 +25,7 @@ import android.content.Context; import android.content.UndoManager; import android.content.res.ColorStateList; import android.content.res.CompatibilityInfo; +import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; @@ -526,6 +527,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private final TextPaint mTextPaint; private boolean mUserSetTextScaleX; private Layout mLayout; + private boolean mLocaleChanged = false; private int mGravity = Gravity.TOP | Gravity.START; private boolean mHorizontallyScrolling; @@ -2740,9 +2742,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * @see Paint#setTextLocale */ public void setTextLocale(Locale locale) { + mLocaleChanged = true; mTextPaint.setTextLocale(locale); } + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + if (!mLocaleChanged) { + mTextPaint.setTextLocale(Locale.getDefault()); + } + } + /** * @return the size (in pixels) of the default text size in this TextView. */ |