summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2014-07-01 14:35:07 -0700
committerJonathan Miranda <jonmiranda@google.com>2014-07-10 21:35:22 +0000
commita25dc428db3ec951933b619b2e0cbad8e2244b52 (patch)
tree6b87047cb57c7e1a866d79b431760b376dc3527d /core/java/android/widget/TextView.java
parent633f0e875dd6bda31f575fe4bc0187e9f245403f (diff)
Exposes more properties to assist in evaluating contrast ratios.
Change-Id: I43468df4d842e03001ab33e139095afadaeacd20
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index dd58ba6d4c03..fac0eb269a26 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -279,6 +279,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
private ColorStateList mTextColor;
private ColorStateList mHintTextColor;
private ColorStateList mLinkTextColor;
+ @ViewDebug.ExportedProperty(category = "text")
private int mCurTextColor;
private int mCurHintTextColor;
private boolean mFreezesText;
@@ -2519,6 +2520,26 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
/**
+ * @return the size (in scaled pixels) of thee default text size in this TextView.
+ * @hide
+ */
+ @ViewDebug.ExportedProperty(category = "text")
+ public float getScaledTextSize() {
+ return mTextPaint.getTextSize() / mTextPaint.density;
+ }
+
+ /** @hide */
+ @ViewDebug.ExportedProperty(category = "text", mapping = {
+ @ViewDebug.IntToString(from = Typeface.NORMAL, to = "NORMAL"),
+ @ViewDebug.IntToString(from = Typeface.BOLD, to = "BOLD"),
+ @ViewDebug.IntToString(from = Typeface.ITALIC, to = "ITALIC"),
+ @ViewDebug.IntToString(from = Typeface.BOLD_ITALIC, to = "BOLD_ITALIC")
+ })
+ public int getTypefaceStyle() {
+ return mTextPaint.getTypeface().getStyle();
+ }
+
+ /**
* Set the default text size to the given value, interpreted as "scaled
* pixel" units. This size is adjusted based on the current density and
* user font size preference.