diff options
| author | Alan Viverette <alanv@google.com> | 2013-09-09 18:09:13 -0700 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2013-09-09 18:09:13 -0700 |
| commit | 617feb99a06e7ffb3894e86a286bf30e085f321a (patch) | |
| tree | 81366597a0234fc7634effbf7cf9d13e2c5c69e2 /core/java/android/widget/TextClock.java | |
| parent | e668c0a1759d35ce3156bcd830ed07d3fddd2ce4 (diff) | |
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/TextClock.java')
| -rw-r--r-- | core/java/android/widget/TextClock.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java index b3b95d917a82..4c5c71ded991 100644 --- a/core/java/android/widget/TextClock.java +++ b/core/java/android/widget/TextClock.java @@ -198,15 +198,19 @@ public class TextClock extends TextView { * @param context The Context the view is running in, through which it can * access the current theme, resources, etc. * @param attrs The attributes of the XML tag that is inflating the view - * @param defStyle The default style to apply to this view. If 0, no style - * will be applied (beyond what is included in the theme). This may - * either be an attribute resource, whose value will be retrieved - * from the current theme, or an explicit style resource + * @param defStyleAttr An attribute in the current theme that contains a + * reference to a style resource that supplies default values for + * the view. Can be 0 to not look for defaults. */ - public TextClock(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public TextClock(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public TextClock(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextClock, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.TextClock, defStyleAttr, defStyleRes); try { mFormat12 = a.getText(R.styleable.TextClock_format12Hour); mFormat24 = a.getText(R.styleable.TextClock_format24Hour); |
