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/SlidingDrawer.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/SlidingDrawer.java')
| -rw-r--r-- | core/java/android/widget/SlidingDrawer.java | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/core/java/android/widget/SlidingDrawer.java b/core/java/android/widget/SlidingDrawer.java index 517246bf5df2..ec06c02b2e2f 100644 --- a/core/java/android/widget/SlidingDrawer.java +++ b/core/java/android/widget/SlidingDrawer.java @@ -192,11 +192,32 @@ public class SlidingDrawer extends ViewGroup { * * @param context The application's environment. * @param attrs The attributes defined in XML. - * @param defStyle The style to apply to this widget. + * @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 SlidingDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SlidingDrawer, defStyle, 0); + public SlidingDrawer(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + /** + * Creates a new SlidingDrawer from a specified set of attributes defined in XML. + * + * @param context The application's environment. + * @param attrs The attributes defined in XML. + * @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. + * @param defStyleRes A resource identifier of a style resource that + * supplies default values for the view, used only if + * defStyleAttr is 0 or can not be found in the theme. Can be 0 + * to not look for defaults. + */ + public SlidingDrawer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.SlidingDrawer, defStyleAttr, defStyleRes); int orientation = a.getInt(R.styleable.SlidingDrawer_orientation, ORIENTATION_VERTICAL); mVertical = orientation == ORIENTATION_VERTICAL; |
