diff options
| author | Seigo Nonaka <nona@google.com> | 2018-09-07 16:55:37 -0700 |
|---|---|---|
| committer | Seigo Nonaka <nona@google.com> | 2018-09-10 10:34:23 -0700 |
| commit | a8fab8acdb4e96d791b4763a1ed97c3202f31a36 (patch) | |
| tree | e30654dd5a96ed16fedcd7aecae43eb8cb05dff0 /core/java/android/widget/TextView.java | |
| parent | a1a74cb44d1f6dd0962d0e7ef1bc0b4474fbb50c (diff) | |
Move maximum weight constant from Typeface to Font and make it public
Now we have Font class. It is good to move max weight constant from
Typeface to Font.
Bug: 112327179
Test: atest FontTest
Change-Id: I3946ac150a02bf0cafa0fc81e61e69c31b45ed1d
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 1b412a7e1e43..0645a162f377 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -63,6 +63,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Typeface; import android.graphics.drawable.Drawable; +import android.graphics.fonts.Font; import android.graphics.fonts.FontVariationAxis; import android.icu.text.DecimalFormatSymbols; import android.os.AsyncTask; @@ -2068,7 +2069,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ private void setTypefaceFromAttrs(@Nullable Typeface typeface, @Nullable String familyName, @XMLTypefaceAttr int typefaceIndex, @Typeface.Style int style, - @IntRange(from = -1, to = Typeface.MAX_WEIGHT) int weight) { + @IntRange(from = -1, to = Font.FONT_WEIGHT_MAX) int weight) { if (typeface == null && familyName != null) { // Lookup normal Typeface from system font map. final Typeface normalTypeface = Typeface.create(familyName, Typeface.NORMAL); @@ -2095,9 +2096,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } private void resolveStyleAndSetTypeface(@NonNull Typeface typeface, @Typeface.Style int style, - @IntRange(from = -1, to = Typeface.MAX_WEIGHT) int weight) { + @IntRange(from = -1, to = Font.FONT_WEIGHT_MAX) int weight) { if (weight >= 0) { - weight = Math.min(Typeface.MAX_WEIGHT, weight); + weight = Math.min(Font.FONT_WEIGHT_MAX, weight); final boolean italic = (style & Typeface.ITALIC) != 0; setTypeface(Typeface.create(typeface, weight, italic)); } else { |
