summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2013-09-09 18:09:13 -0700
committerAlan Viverette <alanv@google.com>2013-09-09 18:09:13 -0700
commit617feb99a06e7ffb3894e86a286bf30e085f321a (patch)
tree81366597a0234fc7634effbf7cf9d13e2c5c69e2 /core/java/android/widget/TextView.java
parente668c0a1759d35ce3156bcd830ed07d3fddd2ce4 (diff)
downloadframeworks_base-617feb99a06e7ffb3894e86a286bf30e085f321a.zip
frameworks_base-617feb99a06e7ffb3894e86a286bf30e085f321a.tar.gz
frameworks_base-617feb99a06e7ffb3894e86a286bf30e085f321a.tar.bz2
Add View constructor that supplies a default style resource
Also updates the constructor of every class that extends View. BUG: 10676369 Change-Id: Ifaf27bf82028d180afa4931c0e906df88d858ac3
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 3c9cc98..5770dcc 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -617,9 +617,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
this(context, attrs, com.android.internal.R.attr.textViewStyle);
}
+ public TextView(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
@SuppressWarnings("deprecation")
- public TextView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
+ public TextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+
mText = "";
final Resources res = getResources();
@@ -656,8 +661,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* to be able to parse the appearance first and then let specific tags
* for this View override it.
*/
- TypedArray a = theme.obtainStyledAttributes(
- attrs, com.android.internal.R.styleable.TextViewAppearance, defStyle, 0);
+ TypedArray a = theme.obtainStyledAttributes(attrs,
+ com.android.internal.R.styleable.TextViewAppearance, defStyleAttr, defStyleRes);
TypedArray appearance = null;
int ap = a.getResourceId(
com.android.internal.R.styleable.TextViewAppearance_textAppearance, -1);
@@ -750,7 +755,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
int inputType = EditorInfo.TYPE_NULL;
a = theme.obtainStyledAttributes(
- attrs, com.android.internal.R.styleable.TextView, defStyle, 0);
+ attrs, com.android.internal.R.styleable.TextView, defStyleAttr, defStyleRes);
int n = a.getIndexCount();
for (int i = 0; i < n; i++) {
@@ -1274,9 +1279,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* However, TextViews that have input or movement methods *are*
* focusable by default.
*/
- a = context.obtainStyledAttributes(attrs,
- com.android.internal.R.styleable.View,
- defStyle, 0);
+ a = context.obtainStyledAttributes(
+ attrs, com.android.internal.R.styleable.View, defStyleAttr, defStyleRes);
boolean focusable = mMovement != null || getKeyListener() != null;
boolean clickable = focusable;