summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2015-01-29 12:49:19 -0800
committerRaph Levien <raph@google.com>2015-01-29 12:49:19 -0800
commit42b3024efdec647266c1ae54a2a7c2c46915b380 (patch)
tree1c7ad580c407c5a11ca5496d3fb5251b2a49e440 /core/java/android/widget/TextView.java
parent1a5ac5b415fea8098686aa08bffc6da3ada31938 (diff)
downloadframeworks_base-42b3024efdec647266c1ae54a2a7c2c46915b380.zip
frameworks_base-42b3024efdec647266c1ae54a2a7c2c46915b380.tar.gz
frameworks_base-42b3024efdec647266c1ae54a2a7c2c46915b380.tar.bz2
Refine resolution order for typeface and fontFamily
Previously any fontFamily value on a TextView would override a typeface value, even if the fontFamily is from a TextAppearance (for example, from the theme) and the typeface is explicitly set. This patch changes the resolution order to fontFamily set directly on the TextView, typeface set directly on the TextView, fontFamily from TextAppearance, typeface from TextAppearance. Bug: 16154223 Change-Id: I45c1e511fba8f64eb236200e3fa2e885c02b59dc
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index cc5d457..7dc64bd 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -658,6 +658,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
ColorStateList textColorLink = null;
int textSize = 15;
String fontFamily = null;
+ boolean fontFamilyExplicit = false;
int typefaceIndex = -1;
int styleIndex = -1;
boolean allCaps = false;
@@ -1012,6 +1013,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
case com.android.internal.R.styleable.TextView_fontFamily:
fontFamily = a.getString(attr);
+ fontFamilyExplicit = true;
break;
case com.android.internal.R.styleable.TextView_password:
@@ -1300,6 +1302,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
typefaceIndex = MONOSPACE;
}
+ if (typefaceIndex != -1 && !fontFamilyExplicit) {
+ fontFamily = null;
+ }
setTypefaceFromAttrs(fontFamily, typefaceIndex, styleIndex);
if (shadowcolor != 0) {