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 | |
parent | e668c0a1759d35ce3156bcd830ed07d3fddd2ce4 (diff) | |
download | frameworks_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
98 files changed, 1130 insertions, 419 deletions
diff --git a/api/current.txt b/api/current.txt index 7a77692..3ab3f32 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3601,6 +3601,7 @@ package android.app { ctor public FragmentBreadCrumbs(android.content.Context); ctor public FragmentBreadCrumbs(android.content.Context, android.util.AttributeSet); ctor public FragmentBreadCrumbs(android.content.Context, android.util.AttributeSet, int); + ctor public FragmentBreadCrumbs(android.content.Context, android.util.AttributeSet, int, int); method public void onBackStackChanged(); method protected void onLayout(boolean, int, int, int, int); method public void setActivity(android.app.Activity); @@ -3887,6 +3888,7 @@ package android.app { ctor public MediaRouteButton(android.content.Context); ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet); ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int); + ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int, int); method public int getRouteTypes(); method public void onAttachedToWindow(); method public void onDetachedFromWindow(); @@ -8744,6 +8746,7 @@ package android.gesture { ctor public GestureOverlayView(android.content.Context); ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet); ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet, int); + ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet, int, int); method public void addOnGestureListener(android.gesture.GestureOverlayView.OnGestureListener); method public void addOnGesturePerformedListener(android.gesture.GestureOverlayView.OnGesturePerformedListener); method public void addOnGesturingListener(android.gesture.GestureOverlayView.OnGesturingListener); @@ -11465,6 +11468,7 @@ package android.inputmethodservice { ctor public ExtractEditText(android.content.Context); ctor public ExtractEditText(android.content.Context, android.util.AttributeSet); ctor public ExtractEditText(android.content.Context, android.util.AttributeSet, int); + ctor public ExtractEditText(android.content.Context, android.util.AttributeSet, int, int); method public void finishInternalChanges(); method public boolean hasVerticalScrollBar(); method public void startInternalChanges(); @@ -11661,6 +11665,7 @@ package android.inputmethodservice { public class KeyboardView extends android.view.View implements android.view.View.OnClickListener { ctor public KeyboardView(android.content.Context, android.util.AttributeSet); ctor public KeyboardView(android.content.Context, android.util.AttributeSet, int); + ctor public KeyboardView(android.content.Context, android.util.AttributeSet, int, int); method public void closing(); method public android.inputmethodservice.Keyboard getKeyboard(); method protected android.inputmethodservice.KeyboardView.OnKeyboardActionListener getOnKeyboardActionListener(); @@ -18677,12 +18682,14 @@ package android.preference { public class CheckBoxPreference extends android.preference.TwoStatePreference { ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int); + ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int, int); ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet); ctor public CheckBoxPreference(android.content.Context); } public abstract class DialogPreference extends android.preference.Preference implements android.content.DialogInterface.OnClickListener android.content.DialogInterface.OnDismissListener android.preference.PreferenceManager.OnActivityDestroyListener { ctor public DialogPreference(android.content.Context, android.util.AttributeSet, int); + ctor public DialogPreference(android.content.Context, android.util.AttributeSet, int, int); ctor public DialogPreference(android.content.Context, android.util.AttributeSet); method public android.app.Dialog getDialog(); method public android.graphics.drawable.Drawable getDialogIcon(); @@ -18714,6 +18721,7 @@ package android.preference { public class EditTextPreference extends android.preference.DialogPreference { ctor public EditTextPreference(android.content.Context, android.util.AttributeSet, int); + ctor public EditTextPreference(android.content.Context, android.util.AttributeSet, int, int); ctor public EditTextPreference(android.content.Context, android.util.AttributeSet); ctor public EditTextPreference(android.content.Context); method public android.widget.EditText getEditText(); @@ -18723,6 +18731,8 @@ package android.preference { } public class ListPreference extends android.preference.DialogPreference { + ctor public ListPreference(android.content.Context, android.util.AttributeSet, int, int); + ctor public ListPreference(android.content.Context, android.util.AttributeSet, int); ctor public ListPreference(android.content.Context, android.util.AttributeSet); ctor public ListPreference(android.content.Context); method public int findIndexOfValue(java.lang.String); @@ -18739,6 +18749,8 @@ package android.preference { } public class MultiSelectListPreference extends android.preference.DialogPreference { + ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int, int); + ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int); ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet); ctor public MultiSelectListPreference(android.content.Context); method public int findIndexOfValue(java.lang.String); @@ -18753,6 +18765,7 @@ package android.preference { } public class Preference implements java.lang.Comparable { + ctor public Preference(android.content.Context, android.util.AttributeSet, int, int); ctor public Preference(android.content.Context, android.util.AttributeSet, int); ctor public Preference(android.content.Context, android.util.AttributeSet); ctor public Preference(android.content.Context); @@ -18918,6 +18931,7 @@ package android.preference { } public class PreferenceCategory extends android.preference.PreferenceGroup { + ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet, int, int); ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet, int); ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet); ctor public PreferenceCategory(android.content.Context); @@ -18939,6 +18953,7 @@ package android.preference { } public abstract class PreferenceGroup extends android.preference.Preference { + ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet, int, int); ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet, int); ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet); method public void addItemFromInflater(android.preference.Preference); @@ -18993,6 +19008,7 @@ package android.preference { } public class RingtonePreference extends android.preference.Preference implements android.preference.PreferenceManager.OnActivityResultListener { + ctor public RingtonePreference(android.content.Context, android.util.AttributeSet, int, int); ctor public RingtonePreference(android.content.Context, android.util.AttributeSet, int); ctor public RingtonePreference(android.content.Context, android.util.AttributeSet); ctor public RingtonePreference(android.content.Context); @@ -19009,6 +19025,7 @@ package android.preference { } public class SwitchPreference extends android.preference.TwoStatePreference { + ctor public SwitchPreference(android.content.Context, android.util.AttributeSet, int, int); ctor public SwitchPreference(android.content.Context, android.util.AttributeSet, int); ctor public SwitchPreference(android.content.Context, android.util.AttributeSet); ctor public SwitchPreference(android.content.Context); @@ -19021,6 +19038,7 @@ package android.preference { } public abstract class TwoStatePreference extends android.preference.Preference { + ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet, int, int); ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet, int); ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet); ctor public TwoStatePreference(android.content.Context); @@ -27379,6 +27397,7 @@ package android.view { ctor public SurfaceView(android.content.Context); ctor public SurfaceView(android.content.Context, android.util.AttributeSet); ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int); + ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int, int); method public boolean gatherTransparentRegion(android.graphics.Region); method public android.view.SurfaceHolder getHolder(); method public void setSecure(boolean); @@ -27390,6 +27409,7 @@ package android.view { ctor public TextureView(android.content.Context); ctor public TextureView(android.content.Context, android.util.AttributeSet); ctor public TextureView(android.content.Context, android.util.AttributeSet, int); + ctor public TextureView(android.content.Context, android.util.AttributeSet, int, int); method public final void draw(android.graphics.Canvas); method public android.graphics.Bitmap getBitmap(); method public android.graphics.Bitmap getBitmap(int, int); @@ -27441,6 +27461,7 @@ package android.view { ctor public View(android.content.Context); ctor public View(android.content.Context, android.util.AttributeSet); ctor public View(android.content.Context, android.util.AttributeSet, int); + ctor public View(android.content.Context, android.util.AttributeSet, int, int); method public void addChildrenForAccessibility(java.util.ArrayList<android.view.View>); method public void addFocusables(java.util.ArrayList<android.view.View>, int); method public void addFocusables(java.util.ArrayList<android.view.View>, int, int); @@ -28174,6 +28195,7 @@ package android.view { ctor public ViewGroup(android.content.Context); ctor public ViewGroup(android.content.Context, android.util.AttributeSet); ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int); + ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int, int); method public boolean addStatesFromChildren(); method public void addView(android.view.View); method public void addView(android.view.View, int); @@ -28424,6 +28446,7 @@ package android.view { ctor public ViewStub(android.content.Context, int); ctor public ViewStub(android.content.Context, android.util.AttributeSet); ctor public ViewStub(android.content.Context, android.util.AttributeSet, int); + ctor public ViewStub(android.content.Context, android.util.AttributeSet, int, int); method public int getInflatedId(); method public android.view.LayoutInflater getLayoutInflater(); method public int getLayoutResource(); @@ -30177,6 +30200,7 @@ package android.webkit { ctor public WebView(android.content.Context); ctor public WebView(android.content.Context, android.util.AttributeSet); ctor public WebView(android.content.Context, android.util.AttributeSet, int); + ctor public WebView(android.content.Context, android.util.AttributeSet, int, int); ctor public deprecated WebView(android.content.Context, android.util.AttributeSet, int, boolean); method public void addJavascriptInterface(java.lang.Object, java.lang.String); method public boolean canGoBack(); @@ -30349,6 +30373,7 @@ package android.widget { ctor public AbsListView(android.content.Context); ctor public AbsListView(android.content.Context, android.util.AttributeSet); ctor public AbsListView(android.content.Context, android.util.AttributeSet, int); + ctor public AbsListView(android.content.Context, android.util.AttributeSet, int, int); method public void afterTextChanged(android.text.Editable); method public void beforeTextChanged(java.lang.CharSequence, int, int, int); method public boolean canScrollList(int); @@ -30462,6 +30487,7 @@ package android.widget { ctor public AbsSeekBar(android.content.Context); ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet); ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet, int); + ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet, int, int); method public int getKeyProgressIncrement(); method public android.graphics.drawable.Drawable getThumb(); method public int getThumbOffset(); @@ -30474,6 +30500,7 @@ package android.widget { ctor public AbsSpinner(android.content.Context); ctor public AbsSpinner(android.content.Context, android.util.AttributeSet); ctor public AbsSpinner(android.content.Context, android.util.AttributeSet, int); + ctor public AbsSpinner(android.content.Context, android.util.AttributeSet, int, int); method public android.widget.SpinnerAdapter getAdapter(); method public android.view.View getSelectedView(); method public void onRestoreInstanceState(android.os.Parcelable); @@ -30488,6 +30515,7 @@ package android.widget { ctor public AbsoluteLayout(android.content.Context); ctor public AbsoluteLayout(android.content.Context, android.util.AttributeSet); ctor public AbsoluteLayout(android.content.Context, android.util.AttributeSet, int); + ctor public AbsoluteLayout(android.content.Context, android.util.AttributeSet, int, int); method protected void onLayout(boolean, int, int, int, int); } @@ -30519,6 +30547,7 @@ package android.widget { ctor public AdapterView(android.content.Context); ctor public AdapterView(android.content.Context, android.util.AttributeSet); ctor public AdapterView(android.content.Context, android.util.AttributeSet, int); + ctor public AdapterView(android.content.Context, android.util.AttributeSet, int, int); method public abstract T getAdapter(); method public int getCount(); method public android.view.View getEmptyView(); @@ -30572,6 +30601,7 @@ package android.widget { ctor public AdapterViewAnimator(android.content.Context); ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet); ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet, int); + ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet, int, int); method public void advance(); method public void deferNotifyDataSetChanged(); method public void fyiWillBeAdvancedByHostKThx(); @@ -30601,6 +30631,8 @@ package android.widget { public class AdapterViewFlipper extends android.widget.AdapterViewAnimator { ctor public AdapterViewFlipper(android.content.Context); ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet); + ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet, int); + ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet, int, int); method public int getFlipInterval(); method public boolean isAutoStart(); method public boolean isFlipping(); @@ -30631,6 +30663,7 @@ package android.widget { ctor public AnalogClock(android.content.Context); ctor public AnalogClock(android.content.Context, android.util.AttributeSet); ctor public AnalogClock(android.content.Context, android.util.AttributeSet, int); + ctor public AnalogClock(android.content.Context, android.util.AttributeSet, int, int); } public class ArrayAdapter extends android.widget.BaseAdapter implements android.widget.Filterable { @@ -30663,6 +30696,7 @@ package android.widget { ctor public AutoCompleteTextView(android.content.Context); ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet); ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet, int); + ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet, int, int); method public void clearListSelection(); method protected java.lang.CharSequence convertSelectionToString(java.lang.Object); method public void dismissDropDown(); @@ -30755,12 +30789,14 @@ package android.widget { ctor public Button(android.content.Context); ctor public Button(android.content.Context, android.util.AttributeSet); ctor public Button(android.content.Context, android.util.AttributeSet, int); + ctor public Button(android.content.Context, android.util.AttributeSet, int, int); } public class CalendarView extends android.widget.FrameLayout { ctor public CalendarView(android.content.Context); ctor public CalendarView(android.content.Context, android.util.AttributeSet); ctor public CalendarView(android.content.Context, android.util.AttributeSet, int); + ctor public CalendarView(android.content.Context, android.util.AttributeSet, int, int); method public long getDate(); method public int getDateTextAppearance(); method public int getFirstDayOfWeek(); @@ -30802,6 +30838,7 @@ package android.widget { ctor public CheckBox(android.content.Context); ctor public CheckBox(android.content.Context, android.util.AttributeSet); ctor public CheckBox(android.content.Context, android.util.AttributeSet, int); + ctor public CheckBox(android.content.Context, android.util.AttributeSet, int, int); } public abstract interface Checkable { @@ -30814,6 +30851,7 @@ package android.widget { ctor public CheckedTextView(android.content.Context); ctor public CheckedTextView(android.content.Context, android.util.AttributeSet); ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int); + ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int, int); method public android.graphics.drawable.Drawable getCheckMarkDrawable(); method public boolean isChecked(); method public void setCheckMarkDrawable(int); @@ -30826,6 +30864,7 @@ package android.widget { ctor public Chronometer(android.content.Context); ctor public Chronometer(android.content.Context, android.util.AttributeSet); ctor public Chronometer(android.content.Context, android.util.AttributeSet, int); + ctor public Chronometer(android.content.Context, android.util.AttributeSet, int, int); method public long getBase(); method public java.lang.String getFormat(); method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener(); @@ -30844,6 +30883,7 @@ package android.widget { ctor public CompoundButton(android.content.Context); ctor public CompoundButton(android.content.Context, android.util.AttributeSet); ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int); + ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int, int); method public boolean isChecked(); method public void setButtonDrawable(int); method public void setButtonDrawable(android.graphics.drawable.Drawable); @@ -30915,6 +30955,7 @@ package android.widget { ctor public DatePicker(android.content.Context); ctor public DatePicker(android.content.Context, android.util.AttributeSet); ctor public DatePicker(android.content.Context, android.util.AttributeSet, int); + ctor public DatePicker(android.content.Context, android.util.AttributeSet, int, int); method public android.widget.CalendarView getCalendarView(); method public boolean getCalendarViewShown(); method public int getDayOfMonth(); @@ -30978,6 +31019,7 @@ package android.widget { ctor public EditText(android.content.Context); ctor public EditText(android.content.Context, android.util.AttributeSet); ctor public EditText(android.content.Context, android.util.AttributeSet, int); + ctor public EditText(android.content.Context, android.util.AttributeSet, int, int); method public void extendSelection(int); method public void selectAll(); method public void setSelection(int, int); @@ -31009,6 +31051,7 @@ package android.widget { ctor public ExpandableListView(android.content.Context); ctor public ExpandableListView(android.content.Context, android.util.AttributeSet); ctor public ExpandableListView(android.content.Context, android.util.AttributeSet, int); + ctor public ExpandableListView(android.content.Context, android.util.AttributeSet, int, int); method public boolean collapseGroup(int); method public boolean expandGroup(int); method public boolean expandGroup(int, boolean); @@ -31098,6 +31141,7 @@ package android.widget { ctor public FrameLayout(android.content.Context); ctor public FrameLayout(android.content.Context, android.util.AttributeSet); ctor public FrameLayout(android.content.Context, android.util.AttributeSet, int); + ctor public FrameLayout(android.content.Context, android.util.AttributeSet, int, int); method public deprecated boolean getConsiderGoneChildrenWhenMeasuring(); method public android.graphics.drawable.Drawable getForeground(); method public int getForegroundGravity(); @@ -31122,6 +31166,7 @@ package android.widget { ctor public Gallery(android.content.Context); ctor public Gallery(android.content.Context, android.util.AttributeSet); ctor public Gallery(android.content.Context, android.util.AttributeSet, int); + ctor public Gallery(android.content.Context, android.util.AttributeSet, int, int); method public boolean onDown(android.view.MotionEvent); method public boolean onFling(android.view.MotionEvent, android.view.MotionEvent, float, float); method public void onLongPress(android.view.MotionEvent); @@ -31143,6 +31188,7 @@ package android.widget { public class GridLayout extends android.view.ViewGroup { ctor public GridLayout(android.content.Context, android.util.AttributeSet, int); + ctor public GridLayout(android.content.Context, android.util.AttributeSet, int, int); ctor public GridLayout(android.content.Context, android.util.AttributeSet); ctor public GridLayout(android.content.Context); method public int getAlignmentMode(); @@ -31202,6 +31248,7 @@ package android.widget { ctor public GridView(android.content.Context); ctor public GridView(android.content.Context, android.util.AttributeSet); ctor public GridView(android.content.Context, android.util.AttributeSet, int); + ctor public GridView(android.content.Context, android.util.AttributeSet, int, int); method public android.widget.ListAdapter getAdapter(); method public int getColumnWidth(); method public int getGravity(); @@ -31259,6 +31306,7 @@ package android.widget { ctor public HorizontalScrollView(android.content.Context); ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet); ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet, int); + ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet, int, int); method public boolean arrowScroll(int); method protected int computeScrollDeltaToGetChildRectOnScreen(android.graphics.Rect); method public boolean executeKeyEvent(android.view.KeyEvent); @@ -31278,6 +31326,7 @@ package android.widget { ctor public ImageButton(android.content.Context); ctor public ImageButton(android.content.Context, android.util.AttributeSet); ctor public ImageButton(android.content.Context, android.util.AttributeSet, int); + ctor public ImageButton(android.content.Context, android.util.AttributeSet, int, int); } public class ImageSwitcher extends android.widget.ViewSwitcher { @@ -31292,6 +31341,7 @@ package android.widget { ctor public ImageView(android.content.Context); ctor public ImageView(android.content.Context, android.util.AttributeSet); ctor public ImageView(android.content.Context, android.util.AttributeSet, int); + ctor public ImageView(android.content.Context, android.util.AttributeSet, int, int); method public final void clearColorFilter(); method public boolean getAdjustViewBounds(); method public boolean getBaselineAlignBottom(); @@ -31343,6 +31393,7 @@ package android.widget { ctor public LinearLayout(android.content.Context); ctor public LinearLayout(android.content.Context, android.util.AttributeSet); ctor public LinearLayout(android.content.Context, android.util.AttributeSet, int); + ctor public LinearLayout(android.content.Context, android.util.AttributeSet, int, int); method public int getBaselineAlignedChildIndex(); method public android.graphics.drawable.Drawable getDividerDrawable(); method public int getDividerPadding(); @@ -31452,6 +31503,7 @@ package android.widget { ctor public ListView(android.content.Context); ctor public ListView(android.content.Context, android.util.AttributeSet); ctor public ListView(android.content.Context, android.util.AttributeSet, int); + ctor public ListView(android.content.Context, android.util.AttributeSet, int, int); method public void addFooterView(android.view.View, java.lang.Object, boolean); method public void addFooterView(android.view.View); method public void addHeaderView(android.view.View, java.lang.Object, boolean); @@ -31524,6 +31576,7 @@ package android.widget { ctor public MultiAutoCompleteTextView(android.content.Context); ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet); ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet, int); + ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet, int, int); method protected void performFiltering(java.lang.CharSequence, int, int, int); method public void setTokenizer(android.widget.MultiAutoCompleteTextView.Tokenizer); } @@ -31545,6 +31598,7 @@ package android.widget { ctor public NumberPicker(android.content.Context); ctor public NumberPicker(android.content.Context, android.util.AttributeSet); ctor public NumberPicker(android.content.Context, android.util.AttributeSet, int); + ctor public NumberPicker(android.content.Context, android.util.AttributeSet, int, int); method public java.lang.String[] getDisplayedValues(); method public int getMaxValue(); method public int getMinValue(); @@ -31688,6 +31742,7 @@ package android.widget { ctor public ProgressBar(android.content.Context); ctor public ProgressBar(android.content.Context, android.util.AttributeSet); ctor public ProgressBar(android.content.Context, android.util.AttributeSet, int); + ctor public ProgressBar(android.content.Context, android.util.AttributeSet, int, int); method public android.graphics.drawable.Drawable getIndeterminateDrawable(); method public android.view.animation.Interpolator getInterpolator(); method public synchronized int getMax(); @@ -31713,6 +31768,7 @@ package android.widget { ctor public QuickContactBadge(android.content.Context); ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet); ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet, int); + ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet, int, int); method public void assignContactFromEmail(java.lang.String, boolean); method public void assignContactFromEmail(java.lang.String, boolean, android.os.Bundle); method public void assignContactFromPhone(java.lang.String, boolean); @@ -31729,6 +31785,7 @@ package android.widget { ctor public RadioButton(android.content.Context); ctor public RadioButton(android.content.Context, android.util.AttributeSet); ctor public RadioButton(android.content.Context, android.util.AttributeSet, int); + ctor public RadioButton(android.content.Context, android.util.AttributeSet, int, int); } public class RadioGroup extends android.widget.LinearLayout { @@ -31754,6 +31811,7 @@ package android.widget { public class RatingBar extends android.widget.AbsSeekBar { ctor public RatingBar(android.content.Context, android.util.AttributeSet, int); + ctor public RatingBar(android.content.Context, android.util.AttributeSet, int, int); ctor public RatingBar(android.content.Context, android.util.AttributeSet); ctor public RatingBar(android.content.Context); method public int getNumStars(); @@ -31776,6 +31834,7 @@ package android.widget { ctor public RelativeLayout(android.content.Context); ctor public RelativeLayout(android.content.Context, android.util.AttributeSet); ctor public RelativeLayout(android.content.Context, android.util.AttributeSet, int); + ctor public RelativeLayout(android.content.Context, android.util.AttributeSet, int, int); method public int getGravity(); method protected void onLayout(boolean, int, int, int, int); method public void setGravity(int); @@ -31924,6 +31983,7 @@ package android.widget { ctor public ScrollView(android.content.Context); ctor public ScrollView(android.content.Context, android.util.AttributeSet); ctor public ScrollView(android.content.Context, android.util.AttributeSet, int); + ctor public ScrollView(android.content.Context, android.util.AttributeSet, int, int); method public boolean arrowScroll(int); method protected int computeScrollDeltaToGetChildRectOnScreen(android.graphics.Rect); method public boolean executeKeyEvent(android.view.KeyEvent); @@ -31968,6 +32028,8 @@ package android.widget { public class SearchView extends android.widget.LinearLayout implements android.view.CollapsibleActionView { ctor public SearchView(android.content.Context); ctor public SearchView(android.content.Context, android.util.AttributeSet); + ctor public SearchView(android.content.Context, android.util.AttributeSet, int); + ctor public SearchView(android.content.Context, android.util.AttributeSet, int, int); method public int getImeOptions(); method public int getInputType(); method public int getMaxWidth(); @@ -32022,6 +32084,7 @@ package android.widget { ctor public SeekBar(android.content.Context); ctor public SeekBar(android.content.Context, android.util.AttributeSet); ctor public SeekBar(android.content.Context, android.util.AttributeSet, int); + ctor public SeekBar(android.content.Context, android.util.AttributeSet, int, int); method public void setOnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener); } @@ -32123,6 +32186,7 @@ package android.widget { public deprecated class SlidingDrawer extends android.view.ViewGroup { ctor public SlidingDrawer(android.content.Context, android.util.AttributeSet); ctor public SlidingDrawer(android.content.Context, android.util.AttributeSet, int); + ctor public SlidingDrawer(android.content.Context, android.util.AttributeSet, int, int); method public void animateClose(); method public void animateOpen(); method public void animateToggle(); @@ -32157,6 +32221,7 @@ package android.widget { } public final class Space extends android.view.View { + ctor public Space(android.content.Context, android.util.AttributeSet, int, int); ctor public Space(android.content.Context, android.util.AttributeSet, int); ctor public Space(android.content.Context, android.util.AttributeSet); ctor public Space(android.content.Context); @@ -32168,6 +32233,7 @@ package android.widget { ctor public Spinner(android.content.Context, android.util.AttributeSet); ctor public Spinner(android.content.Context, android.util.AttributeSet, int); ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int); + ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int); method public int getDropDownHorizontalOffset(); method public int getDropDownVerticalOffset(); method public int getDropDownWidth(); @@ -32195,12 +32261,14 @@ package android.widget { ctor public StackView(android.content.Context); ctor public StackView(android.content.Context, android.util.AttributeSet); ctor public StackView(android.content.Context, android.util.AttributeSet, int); + ctor public StackView(android.content.Context, android.util.AttributeSet, int, int); } public class Switch extends android.widget.CompoundButton { ctor public Switch(android.content.Context); ctor public Switch(android.content.Context, android.util.AttributeSet); ctor public Switch(android.content.Context, android.util.AttributeSet, int); + ctor public Switch(android.content.Context, android.util.AttributeSet, int, int); method public int getSwitchMinWidth(); method public int getSwitchPadding(); method public java.lang.CharSequence getTextOff(); @@ -32226,6 +32294,8 @@ package android.widget { public class TabHost extends android.widget.FrameLayout implements android.view.ViewTreeObserver.OnTouchModeChangeListener { ctor public TabHost(android.content.Context); ctor public TabHost(android.content.Context, android.util.AttributeSet); + ctor public TabHost(android.content.Context, android.util.AttributeSet, int); + ctor public TabHost(android.content.Context, android.util.AttributeSet, int, int); method public void addTab(android.widget.TabHost.TabSpec); method public void clearAllTabs(); method public int getCurrentTab(); @@ -32265,6 +32335,7 @@ package android.widget { ctor public TabWidget(android.content.Context); ctor public TabWidget(android.content.Context, android.util.AttributeSet); ctor public TabWidget(android.content.Context, android.util.AttributeSet, int); + ctor public TabWidget(android.content.Context, android.util.AttributeSet, int, int); method public void dispatchDraw(android.graphics.Canvas); method public void focusCurrentTab(int); method public android.view.View getChildTabViewAt(int); @@ -32327,6 +32398,7 @@ package android.widget { ctor public TextClock(android.content.Context); ctor public TextClock(android.content.Context, android.util.AttributeSet); ctor public TextClock(android.content.Context, android.util.AttributeSet, int); + ctor public TextClock(android.content.Context, android.util.AttributeSet, int, int); method public java.lang.CharSequence getFormat12Hour(); method public java.lang.CharSequence getFormat24Hour(); method public java.lang.String getTimeZone(); @@ -32349,6 +32421,7 @@ package android.widget { ctor public TextView(android.content.Context); ctor public TextView(android.content.Context, android.util.AttributeSet); ctor public TextView(android.content.Context, android.util.AttributeSet, int); + ctor public TextView(android.content.Context, android.util.AttributeSet, int, int); method public void addTextChangedListener(android.text.TextWatcher); method public final void append(java.lang.CharSequence); method public void append(java.lang.CharSequence, int, int); @@ -32556,6 +32629,7 @@ package android.widget { ctor public TimePicker(android.content.Context); ctor public TimePicker(android.content.Context, android.util.AttributeSet); ctor public TimePicker(android.content.Context, android.util.AttributeSet, int); + ctor public TimePicker(android.content.Context, android.util.AttributeSet, int, int); method public java.lang.Integer getCurrentHour(); method public java.lang.Integer getCurrentMinute(); method public boolean is24HourView(); @@ -32593,6 +32667,7 @@ package android.widget { } public class ToggleButton extends android.widget.CompoundButton { + ctor public ToggleButton(android.content.Context, android.util.AttributeSet, int, int); ctor public ToggleButton(android.content.Context, android.util.AttributeSet, int); ctor public ToggleButton(android.content.Context, android.util.AttributeSet); ctor public ToggleButton(android.content.Context); @@ -32606,6 +32681,7 @@ package android.widget { ctor public TwoLineListItem(android.content.Context); ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet); ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet, int); + ctor public TwoLineListItem(android.content.Context, android.util.AttributeSet, int, int); method public android.widget.TextView getText1(); method public android.widget.TextView getText2(); } @@ -32614,6 +32690,7 @@ package android.widget { ctor public VideoView(android.content.Context); ctor public VideoView(android.content.Context, android.util.AttributeSet); ctor public VideoView(android.content.Context, android.util.AttributeSet, int); + ctor public VideoView(android.content.Context, android.util.AttributeSet, int, int); method public void addSubtitleSource(java.io.InputStream, android.media.MediaFormat); method public boolean canPause(); method public boolean canSeekBackward(); @@ -32688,6 +32765,7 @@ package android.widget { ctor public ZoomButton(android.content.Context); ctor public ZoomButton(android.content.Context, android.util.AttributeSet); ctor public ZoomButton(android.content.Context, android.util.AttributeSet, int); + ctor public ZoomButton(android.content.Context, android.util.AttributeSet, int, int); method public boolean onLongClick(android.view.View); method public void setZoomSpeed(long); } diff --git a/core/java/android/app/FragmentBreadCrumbs.java b/core/java/android/app/FragmentBreadCrumbs.java index b810b89..3c09f14 100644 --- a/core/java/android/app/FragmentBreadCrumbs.java +++ b/core/java/android/app/FragmentBreadCrumbs.java @@ -84,11 +84,16 @@ public class FragmentBreadCrumbs extends ViewGroup this(context, attrs, android.R.style.Widget_FragmentBreadCrumbs); } - public FragmentBreadCrumbs(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public FragmentBreadCrumbs(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public FragmentBreadCrumbs( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.FragmentBreadCrumbs, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.FragmentBreadCrumbs, defStyleAttr, defStyleRes); mGravity = a.getInt(com.android.internal.R.styleable.FragmentBreadCrumbs_gravity, DEFAULT_GRAVITY); diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java index 7e0a27a..2464e35 100644 --- a/core/java/android/app/MediaRouteButton.java +++ b/core/java/android/app/MediaRouteButton.java @@ -75,12 +75,17 @@ public class MediaRouteButton extends View { } public MediaRouteButton(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); + this(context, attrs, defStyleAttr, 0); + } + + public MediaRouteButton( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mRouter = (MediaRouter)context.getSystemService(Context.MEDIA_ROUTER_SERVICE); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.MediaRouteButton, defStyleAttr, 0); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.MediaRouteButton, defStyleAttr, defStyleRes); setRemoteIndicatorDrawable(a.getDrawable( com.android.internal.R.styleable.MediaRouteButton_externalRouteEnabledDrawable)); mMinWidth = a.getDimensionPixelSize( diff --git a/core/java/android/gesture/GestureOverlayView.java b/core/java/android/gesture/GestureOverlayView.java index 2d47f28..6e3a00f 100644 --- a/core/java/android/gesture/GestureOverlayView.java +++ b/core/java/android/gesture/GestureOverlayView.java @@ -134,11 +134,16 @@ public class GestureOverlayView extends FrameLayout { this(context, attrs, com.android.internal.R.attr.gestureOverlayViewStyle); } - public GestureOverlayView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public GestureOverlayView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public GestureOverlayView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - R.styleable.GestureOverlayView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.GestureOverlayView, defStyleAttr, defStyleRes); mGestureStrokeWidth = a.getFloat(R.styleable.GestureOverlayView_gestureStrokeWidth, mGestureStrokeWidth); diff --git a/core/java/android/inputmethodservice/ExtractButton.java b/core/java/android/inputmethodservice/ExtractButton.java index b6b7595..fe63c1e 100644 --- a/core/java/android/inputmethodservice/ExtractButton.java +++ b/core/java/android/inputmethodservice/ExtractButton.java @@ -32,8 +32,12 @@ class ExtractButton extends Button { super(context, attrs, com.android.internal.R.attr.buttonStyle); } - public ExtractButton(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ExtractButton(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ExtractButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } /** diff --git a/core/java/android/inputmethodservice/ExtractEditText.java b/core/java/android/inputmethodservice/ExtractEditText.java index 23ae21b..48b604c 100644 --- a/core/java/android/inputmethodservice/ExtractEditText.java +++ b/core/java/android/inputmethodservice/ExtractEditText.java @@ -38,8 +38,12 @@ public class ExtractEditText extends EditText { super(context, attrs, com.android.internal.R.attr.editTextStyle); } - public ExtractEditText(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ExtractEditText(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ExtractEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } void setIME(InputMethodService ime) { diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java index 4916244..af75a0a 100644 --- a/core/java/android/inputmethodservice/KeyboardView.java +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -279,12 +279,15 @@ public class KeyboardView extends View implements View.OnClickListener { this(context, attrs, com.android.internal.R.attr.keyboardViewStyle); } - public KeyboardView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public KeyboardView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public KeyboardView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = - context.obtainStyledAttributes( - attrs, android.R.styleable.KeyboardView, defStyle, 0); + TypedArray a = context.obtainStyledAttributes( + attrs, android.R.styleable.KeyboardView, defStyleAttr, defStyleRes); LayoutInflater inflate = (LayoutInflater) context diff --git a/core/java/android/preference/CheckBoxPreference.java b/core/java/android/preference/CheckBoxPreference.java index 1536760..1ce98b8 100644 --- a/core/java/android/preference/CheckBoxPreference.java +++ b/core/java/android/preference/CheckBoxPreference.java @@ -34,11 +34,16 @@ import android.widget.Checkable; */ public class CheckBoxPreference extends TwoStatePreference { - public CheckBoxPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.CheckBoxPreference, defStyle, 0); + public CheckBoxPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public CheckBoxPreference( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.CheckBoxPreference, defStyleAttr, defStyleRes); setSummaryOn(a.getString(com.android.internal.R.styleable.CheckBoxPreference_summaryOn)); setSummaryOff(a.getString(com.android.internal.R.styleable.CheckBoxPreference_summaryOff)); setDisableDependentsState(a.getBoolean( diff --git a/core/java/android/preference/DialogPreference.java b/core/java/android/preference/DialogPreference.java index a643c8a..dc1f965 100644 --- a/core/java/android/preference/DialogPreference.java +++ b/core/java/android/preference/DialogPreference.java @@ -65,11 +65,16 @@ public abstract class DialogPreference extends Preference implements /** Which button was clicked. */ private int mWhichButtonClicked; - public DialogPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.DialogPreference, defStyle, 0); + public DialogPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public DialogPreference( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.DialogPreference, defStyleAttr, defStyleRes); mDialogTitle = a.getString(com.android.internal.R.styleable.DialogPreference_dialogTitle); if (mDialogTitle == null) { // Fallback on the regular title of the preference diff --git a/core/java/android/preference/EditTextPreference.java b/core/java/android/preference/EditTextPreference.java index aa27627..d5d339b 100644 --- a/core/java/android/preference/EditTextPreference.java +++ b/core/java/android/preference/EditTextPreference.java @@ -50,8 +50,12 @@ public class EditTextPreference extends DialogPreference { private String mText; - public EditTextPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mEditText = new EditText(context, attrs); diff --git a/core/java/android/preference/ListPreference.java b/core/java/android/preference/ListPreference.java index 9edf112..fad75db 100644 --- a/core/java/android/preference/ListPreference.java +++ b/core/java/android/preference/ListPreference.java @@ -42,12 +42,12 @@ public class ListPreference extends DialogPreference { private String mSummary; private int mClickedDialogEntryIndex; private boolean mValueSet; - - public ListPreference(Context context, AttributeSet attrs) { - super(context, attrs); - - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.ListPreference, 0, 0); + + public ListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ListPreference, defStyleAttr, defStyleRes); mEntries = a.getTextArray(com.android.internal.R.styleable.ListPreference_entries); mEntryValues = a.getTextArray(com.android.internal.R.styleable.ListPreference_entryValues); a.recycle(); @@ -56,11 +56,19 @@ public class ListPreference extends DialogPreference { * in the Preference class. */ a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Preference, 0, 0); + com.android.internal.R.styleable.Preference, defStyleAttr, defStyleRes); mSummary = a.getString(com.android.internal.R.styleable.Preference_summary); a.recycle(); } + public ListPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ListPreference(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + public ListPreference(Context context) { this(context, null); } diff --git a/core/java/android/preference/MultiCheckPreference.java b/core/java/android/preference/MultiCheckPreference.java index 6953075..ad39d24 100644 --- a/core/java/android/preference/MultiCheckPreference.java +++ b/core/java/android/preference/MultiCheckPreference.java @@ -40,12 +40,13 @@ public class MultiCheckPreference extends DialogPreference { private boolean[] mSetValues; private boolean[] mOrigValues; private String mSummary; - - public MultiCheckPreference(Context context, AttributeSet attrs) { - super(context, attrs); - - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.ListPreference, 0, 0); + + public MultiCheckPreference( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ListPreference, defStyleAttr, defStyleRes); mEntries = a.getTextArray(com.android.internal.R.styleable.ListPreference_entries); if (mEntries != null) { setEntries(mEntries); @@ -63,6 +64,14 @@ public class MultiCheckPreference extends DialogPreference { a.recycle(); } + public MultiCheckPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public MultiCheckPreference(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + public MultiCheckPreference(Context context) { this(context, null); } diff --git a/core/java/android/preference/MultiSelectListPreference.java b/core/java/android/preference/MultiSelectListPreference.java index 553ce80..82ca646 100644 --- a/core/java/android/preference/MultiSelectListPreference.java +++ b/core/java/android/preference/MultiSelectListPreference.java @@ -44,16 +44,26 @@ public class MultiSelectListPreference extends DialogPreference { private Set<String> mValues = new HashSet<String>(); private Set<String> mNewValues = new HashSet<String>(); private boolean mPreferenceChanged; - - public MultiSelectListPreference(Context context, AttributeSet attrs) { - super(context, attrs); - - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.MultiSelectListPreference, 0, 0); + + public MultiSelectListPreference( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.MultiSelectListPreference, defStyleAttr, + defStyleRes); mEntries = a.getTextArray(com.android.internal.R.styleable.MultiSelectListPreference_entries); mEntryValues = a.getTextArray(com.android.internal.R.styleable.MultiSelectListPreference_entryValues); a.recycle(); } + + public MultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public MultiSelectListPreference(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } public MultiSelectListPreference(Context context) { this(context, null); diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index 37a8102..9abd7ef 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -188,30 +188,33 @@ public class Preference implements Comparable<Preference> { /** * Perform inflation from XML and apply a class-specific base style. This - * constructor of Preference allows subclasses to use their own base - * style when they are inflating. For example, a {@link CheckBoxPreference} + * constructor of Preference allows subclasses to use their own base style + * when they are inflating. For example, a {@link CheckBoxPreference} * constructor calls this version of the super class constructor and - * supplies {@code android.R.attr.checkBoxPreferenceStyle} for <var>defStyle</var>. - * This allows the theme's checkbox preference style to modify all of the base - * preference attributes as well as the {@link CheckBoxPreference} class's - * attributes. - * + * supplies {@code android.R.attr.checkBoxPreferenceStyle} for + * <var>defStyleAttr</var>. This allows the theme's checkbox preference + * style to modify all of the base preference attributes as well as the + * {@link CheckBoxPreference} class's attributes. + * * @param context The Context this is associated with, through which it can - * access the current theme, resources, {@link SharedPreferences}, - * etc. - * @param attrs The attributes of the XML tag that is inflating the preference. - * @param defStyle The default style to apply to this preference. 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. + * access the current theme, resources, + * {@link SharedPreferences}, etc. + * @param attrs The attributes of the XML tag that is inflating the + * preference. + * @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. * @see #Preference(Context, AttributeSet) */ - public Preference(Context context, AttributeSet attrs, int defStyle) { + public Preference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { mContext = context; - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Preference, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.Preference, defStyleAttr, defStyleRes); for (int i = a.getIndexCount(); i >= 0; i--) { int attr = a.getIndex(i); switch (attr) { @@ -281,6 +284,30 @@ public class Preference implements Comparable<Preference> { mCanRecycleLayout = false; } } + + /** + * Perform inflation from XML and apply a class-specific base style. This + * constructor of Preference allows subclasses to use their own base style + * when they are inflating. For example, a {@link CheckBoxPreference} + * constructor calls this version of the super class constructor and + * supplies {@code android.R.attr.checkBoxPreferenceStyle} for + * <var>defStyleAttr</var>. This allows the theme's checkbox preference + * style to modify all of the base preference attributes as well as the + * {@link CheckBoxPreference} class's attributes. + * + * @param context The Context this is associated with, through which it can + * access the current theme, resources, + * {@link SharedPreferences}, etc. + * @param attrs The attributes of the XML tag that is inflating the + * preference. + * @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. + * @see #Preference(Context, AttributeSet) + */ + public Preference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } /** * Constructor that is called when inflating a Preference from XML. This is diff --git a/core/java/android/preference/PreferenceCategory.java b/core/java/android/preference/PreferenceCategory.java index 229a96a..9c9b36e 100644 --- a/core/java/android/preference/PreferenceCategory.java +++ b/core/java/android/preference/PreferenceCategory.java @@ -34,9 +34,14 @@ import android.util.AttributeSet; */ public class PreferenceCategory extends PreferenceGroup { private static final String TAG = "PreferenceCategory"; - - public PreferenceCategory(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + + public PreferenceCategory( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + public PreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); } public PreferenceCategory(Context context, AttributeSet attrs) { diff --git a/core/java/android/preference/PreferenceFrameLayout.java b/core/java/android/preference/PreferenceFrameLayout.java index 75372aa..3210998 100644 --- a/core/java/android/preference/PreferenceFrameLayout.java +++ b/core/java/android/preference/PreferenceFrameLayout.java @@ -45,10 +45,15 @@ public class PreferenceFrameLayout extends FrameLayout { this(context, attrs, com.android.internal.R.attr.preferenceFrameLayoutStyle); } - public PreferenceFrameLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.PreferenceFrameLayout, defStyle, 0); + public PreferenceFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public PreferenceFrameLayout( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.PreferenceFrameLayout, defStyleAttr, defStyleRes); float density = context.getResources().getDisplayMetrics().density; int defaultBorderTop = (int) (density * DEFAULT_BORDER_TOP + 0.5f); diff --git a/core/java/android/preference/PreferenceGroup.java b/core/java/android/preference/PreferenceGroup.java index 5f8c78d..2d35b1b 100644 --- a/core/java/android/preference/PreferenceGroup.java +++ b/core/java/android/preference/PreferenceGroup.java @@ -55,19 +55,23 @@ public abstract class PreferenceGroup extends Preference implements GenericInfla private int mCurrentPreferenceOrder = 0; private boolean mAttachedToActivity = false; - - public PreferenceGroup(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + + public PreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mPreferenceList = new ArrayList<Preference>(); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.PreferenceGroup, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.PreferenceGroup, defStyleAttr, defStyleRes); mOrderingAsAdded = a.getBoolean(com.android.internal.R.styleable.PreferenceGroup_orderingFromXml, mOrderingAsAdded); a.recycle(); } + public PreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + public PreferenceGroup(Context context, AttributeSet attrs) { this(context, attrs, 0); } diff --git a/core/java/android/preference/RingtonePreference.java b/core/java/android/preference/RingtonePreference.java index 2ebf294..488a0c4 100644 --- a/core/java/android/preference/RingtonePreference.java +++ b/core/java/android/preference/RingtonePreference.java @@ -50,11 +50,11 @@ public class RingtonePreference extends Preference implements private int mRequestCode; - public RingtonePreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.RingtonePreference, defStyle, 0); + public RingtonePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.RingtonePreference, defStyleAttr, defStyleRes); mRingtoneType = a.getInt(com.android.internal.R.styleable.RingtonePreference_ringtoneType, RingtoneManager.TYPE_RINGTONE); mShowDefault = a.getBoolean(com.android.internal.R.styleable.RingtonePreference_showDefault, @@ -64,6 +64,10 @@ public class RingtonePreference extends Preference implements a.recycle(); } + public RingtonePreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + public RingtonePreference(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.ringtonePreferenceStyle); } diff --git a/core/java/android/preference/SeekBarDialogPreference.java b/core/java/android/preference/SeekBarDialogPreference.java index 0e89b16..0c3c496 100644 --- a/core/java/android/preference/SeekBarDialogPreference.java +++ b/core/java/android/preference/SeekBarDialogPreference.java @@ -32,8 +32,9 @@ public class SeekBarDialogPreference extends DialogPreference { private Drawable mMyIcon; - public SeekBarDialogPreference(Context context, AttributeSet attrs) { - super(context, attrs); + public SeekBarDialogPreference( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); setDialogLayoutResource(com.android.internal.R.layout.seekbar_dialog); createActionButtons(); @@ -43,6 +44,14 @@ public class SeekBarDialogPreference extends DialogPreference { setDialogIcon(null); } + public SeekBarDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public SeekBarDialogPreference(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + // Allow subclasses to override the action buttons public void createActionButtons() { setPositiveButtonText(android.R.string.ok); diff --git a/core/java/android/preference/SeekBarPreference.java b/core/java/android/preference/SeekBarPreference.java index 7133d3a..e32890d 100644 --- a/core/java/android/preference/SeekBarPreference.java +++ b/core/java/android/preference/SeekBarPreference.java @@ -37,15 +37,20 @@ public class SeekBarPreference extends Preference private boolean mTrackingTouch; public SeekBarPreference( - Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.ProgressBar, defStyle, 0); + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ProgressBar, defStyleAttr, defStyleRes); setMax(a.getInt(com.android.internal.R.styleable.ProgressBar_max, mMax)); a.recycle(); setLayoutResource(com.android.internal.R.layout.preference_widget_seekbar); } + public SeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + public SeekBarPreference(Context context, AttributeSet attrs) { this(context, attrs, 0); } diff --git a/core/java/android/preference/SwitchPreference.java b/core/java/android/preference/SwitchPreference.java index 8bac6bd..76ef544 100644 --- a/core/java/android/preference/SwitchPreference.java +++ b/core/java/android/preference/SwitchPreference.java @@ -60,13 +60,19 @@ public class SwitchPreference extends TwoStatePreference { * * @param context The Context that will style this preference * @param attrs Style attributes that differ from the default - * @param defStyle Theme attribute defining the default style options + * @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 SwitchPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public SwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.SwitchPreference, defStyle, 0); + com.android.internal.R.styleable.SwitchPreference, defStyleAttr, defStyleRes); setSummaryOn(a.getString(com.android.internal.R.styleable.SwitchPreference_summaryOn)); setSummaryOff(a.getString(com.android.internal.R.styleable.SwitchPreference_summaryOff)); setSwitchTextOn(a.getString( @@ -83,6 +89,19 @@ public class SwitchPreference extends TwoStatePreference { * * @param context The Context that will style this preference * @param attrs Style attributes that differ from the default + * @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 SwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + /** + * Construct a new SwitchPreference with the given style options. + * + * @param context The Context that will style this preference + * @param attrs Style attributes that differ from the default */ public SwitchPreference(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.switchPreferenceStyle); diff --git a/core/java/android/preference/TwoStatePreference.java b/core/java/android/preference/TwoStatePreference.java index c649879..645c742 100644 --- a/core/java/android/preference/TwoStatePreference.java +++ b/core/java/android/preference/TwoStatePreference.java @@ -41,9 +41,13 @@ public abstract class TwoStatePreference extends Preference { private boolean mSendClickAccessibilityEvent; private boolean mDisableDependentsState; + public TwoStatePreference( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } - public TwoStatePreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public TwoStatePreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); } public TwoStatePreference(Context context, AttributeSet attrs) { diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java index dc683a6..29f2545 100644 --- a/core/java/android/preference/VolumePreference.java +++ b/core/java/android/preference/VolumePreference.java @@ -51,15 +51,24 @@ public class VolumePreference extends SeekBarDialogPreference implements /** May be null if the dialog isn't visible. */ private SeekBarVolumizer mSeekBarVolumizer; - public VolumePreference(Context context, AttributeSet attrs) { - super(context, attrs); + public VolumePreference( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.VolumePreference, 0, 0); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.VolumePreference, defStyleAttr, defStyleRes); mStreamType = a.getInt(android.R.styleable.VolumePreference_streamType, 0); a.recycle(); } + public VolumePreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public VolumePreference(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + public void setStreamType(int streamType) { mStreamType = streamType; } diff --git a/core/java/android/text/style/SuggestionSpan.java b/core/java/android/text/style/SuggestionSpan.java index 0ec7e84..8b40953 100644 --- a/core/java/android/text/style/SuggestionSpan.java +++ b/core/java/android/text/style/SuggestionSpan.java @@ -166,25 +166,25 @@ public class SuggestionSpan extends CharacterStyle implements ParcelableSpan { return; } - int defStyle = com.android.internal.R.attr.textAppearanceMisspelledSuggestion; + int defStyleAttr = com.android.internal.R.attr.textAppearanceMisspelledSuggestion; TypedArray typedArray = context.obtainStyledAttributes( - null, com.android.internal.R.styleable.SuggestionSpan, defStyle, 0); + null, com.android.internal.R.styleable.SuggestionSpan, defStyleAttr, 0); mMisspelledUnderlineThickness = typedArray.getDimension( com.android.internal.R.styleable.SuggestionSpan_textUnderlineThickness, 0); mMisspelledUnderlineColor = typedArray.getColor( com.android.internal.R.styleable.SuggestionSpan_textUnderlineColor, Color.BLACK); - defStyle = com.android.internal.R.attr.textAppearanceEasyCorrectSuggestion; + defStyleAttr = com.android.internal.R.attr.textAppearanceEasyCorrectSuggestion; typedArray = context.obtainStyledAttributes( - null, com.android.internal.R.styleable.SuggestionSpan, defStyle, 0); + null, com.android.internal.R.styleable.SuggestionSpan, defStyleAttr, 0); mEasyCorrectUnderlineThickness = typedArray.getDimension( com.android.internal.R.styleable.SuggestionSpan_textUnderlineThickness, 0); mEasyCorrectUnderlineColor = typedArray.getColor( com.android.internal.R.styleable.SuggestionSpan_textUnderlineColor, Color.BLACK); - defStyle = com.android.internal.R.attr.textAppearanceAutoCorrectionSuggestion; + defStyleAttr = com.android.internal.R.attr.textAppearanceAutoCorrectionSuggestion; typedArray = context.obtainStyledAttributes( - null, com.android.internal.R.styleable.SuggestionSpan, defStyle, 0); + null, com.android.internal.R.styleable.SuggestionSpan, defStyleAttr, 0); mAutoCorrectionUnderlineThickness = typedArray.getDimension( com.android.internal.R.styleable.SuggestionSpan_textUnderlineThickness, 0); mAutoCorrectionUnderlineColor = typedArray.getColor( diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 8b2b556..de86afc 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -187,8 +187,13 @@ public class SurfaceView extends View { init(); } - public SurfaceView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); init(); } diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index b2c9f8c..19de9fa 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -156,14 +156,32 @@ public class TextureView extends View { * * @param context The context to associate this view with. * @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. */ @SuppressWarnings({"UnusedDeclaration"}) - public TextureView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public TextureView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + /** + * Creates a new TextureView. + * + * @param context The context to associate this view with. + * @param attrs The attributes of the XML tag that is inflating the view. + * @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. + */ + @SuppressWarnings({"UnusedDeclaration"}) + public TextureView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); init(); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 650d698..fccb246 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -3392,27 +3392,64 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Perform inflation from XML and apply a class-specific base style. This - * constructor of View allows subclasses to use their own base style when - * they are inflating. For example, a Button class's constructor would call - * this version of the super class constructor and supply - * <code>R.attr.buttonStyle</code> for <var>defStyle</var>; this allows - * the theme's button style to modify all of the base view attributes (in - * particular its background) as well as the Button class's attributes. + * Perform inflation from XML and apply a class-specific base style from a + * theme attribute. This constructor of View allows subclasses to use their + * own base style when they are inflating. For example, a Button class's + * constructor would call this version of the super class constructor and + * supply <code>R.attr.buttonStyle</code> for <var>defStyleAttr</var>; this + * allows the theme's button style to modify all of the base view attributes + * (in particular its background) as well as the Button class's attributes. * * @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 defStyleAttr An attribute in the current theme that contains a - * reference to a style resource to apply to this view. If 0, no - * default style will be applied. + * reference to a style resource that supplies default values for + * the view. Can be 0 to not look for defaults. * @see #View(Context, AttributeSet) */ public View(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + /** + * Perform inflation from XML and apply a class-specific base style from a + * theme attribute or style resource. This constructor of View allows + * subclasses to use their own base style when they are inflating. + * <p> + * When determining the final value of a particular attribute, there are + * four inputs that come into play: + * <ol> + * <li>Any attribute values in the given AttributeSet. + * <li>The style resource specified in the AttributeSet (named "style"). + * <li>The default style specified by <var>defStyleAttr</var>. + * <li>The default style specified by <var>defStyleRes</var>. + * <li>The base values in this theme. + * </ol> + * <p> + * Each of these inputs is considered in-order, with the first listed taking + * precedence over the following ones. In other words, if in the + * AttributeSet you have supplied <code><Button * textColor="#ff000000"></code> + * , then the button's text will <em>always</em> be black, regardless of + * what is specified in any of the styles. + * + * @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 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. + * @see #View(Context, AttributeSet, int) + */ + public View(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { this(context); - TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View, - defStyleAttr, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.View, defStyleAttr, defStyleRes); Drawable background = null; diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index faeee3f..deb8ee6 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -465,8 +465,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager initFromAttributes(context, attrs); } - public ViewGroup(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ViewGroup(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initViewGroup(); + initFromAttributes(context, attrs); + } + + public ViewGroup(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initViewGroup(); initFromAttributes(context, attrs); } diff --git a/core/java/android/view/ViewStub.java b/core/java/android/view/ViewStub.java index a5dc3ae..d68a860 100644 --- a/core/java/android/view/ViewStub.java +++ b/core/java/android/view/ViewStub.java @@ -97,16 +97,21 @@ public final class ViewStub extends View { } @SuppressWarnings({"UnusedDeclaration"}) - public ViewStub(Context context, AttributeSet attrs, int defStyle) { - TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ViewStub, - defStyle, 0); + public ViewStub(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ViewStub(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ViewStub, defStyleAttr, defStyleRes); mInflatedId = a.getResourceId(R.styleable.ViewStub_inflatedId, NO_ID); mLayoutResource = a.getResourceId(R.styleable.ViewStub_layout, 0); a.recycle(); - a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View, defStyle, 0); + a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.View, defStyleAttr, defStyleRes); mID = a.getResourceId(R.styleable.View_id, NO_ID); a.recycle(); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index bcd26f8..20c67a5 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -441,10 +441,12 @@ public class WebView extends AbsoluteLayout * * @param context a Context object used to access application assets * @param attrs an AttributeSet passed to our parent - * @param defStyle the default style resource ID + * @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 WebView(Context context, AttributeSet attrs, int defStyle) { - this(context, attrs, defStyle, false); + public WebView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); } /** @@ -452,7 +454,26 @@ public class WebView extends AbsoluteLayout * * @param context a Context object used to access application assets * @param attrs an AttributeSet passed to our parent - * @param defStyle the default style resource ID + * @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 WebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + this(context, attrs, defStyleAttr, defStyleRes, null, false); + } + + /** + * Constructs a new WebView with layout parameters and a default style. + * + * @param context a Context object used to access application assets + * @param attrs an AttributeSet passed to our parent + * @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 privateBrowsing whether this WebView will be initialized in * private mode * @@ -462,9 +483,9 @@ public class WebView extends AbsoluteLayout * and {@link WebStorage} for fine-grained control of privacy data. */ @Deprecated - public WebView(Context context, AttributeSet attrs, int defStyle, + public WebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) { - this(context, attrs, defStyle, null, privateBrowsing); + this(context, attrs, defStyleAttr, 0, null, privateBrowsing); } /** @@ -475,7 +496,9 @@ public class WebView extends AbsoluteLayout * * @param context a Context object used to access application assets * @param attrs an AttributeSet passed to our parent - * @param defStyle the default style resource ID + * @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 javaScriptInterfaces a Map of interface names, as keys, and * object implementing those interfaces, as * values @@ -484,10 +507,18 @@ public class WebView extends AbsoluteLayout * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces to * be added synchronously, before a subsequent loadUrl call takes effect. */ + protected WebView(Context context, AttributeSet attrs, int defStyleAttr, + Map<String, Object> javaScriptInterfaces, boolean privateBrowsing) { + this(context, attrs, defStyleAttr, 0, javaScriptInterfaces, privateBrowsing); + } + + /** + * @hide + */ @SuppressWarnings("deprecation") // for super() call into deprecated base class constructor. - protected WebView(Context context, AttributeSet attrs, int defStyle, + protected WebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, Map<String, Object> javaScriptInterfaces, boolean privateBrowsing) { - super(context, attrs, defStyle); + super(context, attrs, defStyleAttr, defStyleRes); if (context == null) { throw new IllegalArgumentException("Invalid context argument"); } diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 7378d74..2d94b15 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -778,14 +778,18 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te this(context, attrs, com.android.internal.R.attr.absListViewStyle); } - public AbsListView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public AbsListView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AbsListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initAbsListView(); mOwnerThread = Thread.currentThread(); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.AbsListView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.AbsListView, defStyleAttr, defStyleRes); Drawable d = a.getDrawable(com.android.internal.R.styleable.AbsListView_listSelector); if (d != null) { diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index 7674837..941cdd0 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -65,11 +65,15 @@ public abstract class AbsSeekBar extends ProgressBar { super(context, attrs); } - public AbsSeekBar(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public AbsSeekBar(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AbsSeekBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.SeekBar, defStyle, 0); + TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.SeekBar, defStyleAttr, defStyleRes); Drawable thumb = a.getDrawable(com.android.internal.R.styleable.SeekBar_thumb); setThumb(thumb); // will guess mThumbOffset if thumb != null... // ...but allow layout to override this diff --git a/core/java/android/widget/AbsSpinner.java b/core/java/android/widget/AbsSpinner.java index f26527f..6a4ad75 100644 --- a/core/java/android/widget/AbsSpinner.java +++ b/core/java/android/widget/AbsSpinner.java @@ -64,12 +64,16 @@ public abstract class AbsSpinner extends AdapterView<SpinnerAdapter> { this(context, attrs, 0); } - public AbsSpinner(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public AbsSpinner(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AbsSpinner(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initAbsSpinner(); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.AbsSpinner, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.AbsSpinner, defStyleAttr, defStyleRes); CharSequence[] entries = a.getTextArray(R.styleable.AbsSpinner_entries); if (entries != null) { diff --git a/core/java/android/widget/AbsoluteLayout.java b/core/java/android/widget/AbsoluteLayout.java index 7df6aab..7952bc1 100644 --- a/core/java/android/widget/AbsoluteLayout.java +++ b/core/java/android/widget/AbsoluteLayout.java @@ -47,9 +47,12 @@ public class AbsoluteLayout extends ViewGroup { super(context, attrs); } - public AbsoluteLayout(Context context, AttributeSet attrs, - int defStyle) { - super(context, attrs, defStyle); + public AbsoluteLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr, 0); + } + + public AbsoluteLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/android/widget/ActivityChooserView.java b/core/java/android/widget/ActivityChooserView.java index dff1531..28514a6 100644 --- a/core/java/android/widget/ActivityChooserView.java +++ b/core/java/android/widget/ActivityChooserView.java @@ -200,13 +200,32 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod * * @param context The application environment. * @param attrs A collection of attributes. - * @param defStyle The default style to apply to this view. + * @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 ActivityChooserView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ActivityChooserView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + /** + * Create a new instance. + * + * @param context The application environment. + * @param attrs A collection of attributes. + * @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 ActivityChooserView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); TypedArray attributesArray = context.obtainStyledAttributes(attrs, - R.styleable.ActivityChooserView, defStyle, 0); + R.styleable.ActivityChooserView, defStyleAttr, defStyleRes); mInitialActivityCount = attributesArray.getInt( R.styleable.ActivityChooserView_initialActivityCount, diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index 31ab0af..19968cb 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -230,8 +230,12 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { super(context, attrs); } - public AdapterView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public AdapterView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AdapterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); // If not explicitly specified this view is important for accessibility. if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java index 90e949a..1bc2f4b 100644 --- a/core/java/android/widget/AdapterViewAnimator.java +++ b/core/java/android/widget/AdapterViewAnimator.java @@ -173,10 +173,15 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> } public AdapterViewAnimator(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); + this(context, attrs, defStyleAttr, 0); + } + + public AdapterViewAnimator( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.AdapterViewAnimator, defStyleAttr, 0); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.AdapterViewAnimator, defStyleAttr, defStyleRes); int resource = a.getResourceId( com.android.internal.R.styleable.AdapterViewAnimator_inAnimation, 0); if (resource > 0) { diff --git a/core/java/android/widget/AdapterViewFlipper.java b/core/java/android/widget/AdapterViewFlipper.java index aea029b..3b026bd 100644 --- a/core/java/android/widget/AdapterViewFlipper.java +++ b/core/java/android/widget/AdapterViewFlipper.java @@ -59,10 +59,19 @@ public class AdapterViewFlipper extends AdapterViewAnimator { } public AdapterViewFlipper(Context context, AttributeSet attrs) { - super(context, attrs); + this(context, attrs, 0); + } + + public AdapterViewFlipper(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AdapterViewFlipper( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.AdapterViewFlipper); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.AdapterViewFlipper, defStyleAttr, defStyleRes); mFlipInterval = a.getInt( com.android.internal.R.styleable.AdapterViewFlipper_flipInterval, DEFAULT_INTERVAL); mAutoStart = a.getBoolean( diff --git a/core/java/android/widget/AnalogClock.java b/core/java/android/widget/AnalogClock.java index c7da818..3c88e94 100644 --- a/core/java/android/widget/AnalogClock.java +++ b/core/java/android/widget/AnalogClock.java @@ -67,13 +67,16 @@ public class AnalogClock extends View { this(context, attrs, 0); } - public AnalogClock(Context context, AttributeSet attrs, - int defStyle) { - super(context, attrs, defStyle); - Resources r = mContext.getResources(); - TypedArray a = - context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.AnalogClock, defStyle, 0); + public AnalogClock(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AnalogClock(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final Resources r = context.getResources(); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.AnalogClock, defStyleAttr, defStyleRes); mDial = a.getDrawable(com.android.internal.R.styleable.AnalogClock_dial); if (mDial == null) { diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index f0eb94f..259c66b 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -133,17 +133,21 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe this(context, attrs, com.android.internal.R.attr.autoCompleteTextViewStyle); } - public AutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public AutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AutoCompleteTextView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mPopup = new ListPopupWindow(context, attrs, com.android.internal.R.attr.autoCompleteTextViewStyle); mPopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mPopup.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW); - TypedArray a = - context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.AutoCompleteTextView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.AutoCompleteTextView, defStyleAttr, defStyleRes); mThreshold = a.getInt( R.styleable.AutoCompleteTextView_completionThreshold, 2); diff --git a/core/java/android/widget/Button.java b/core/java/android/widget/Button.java index 2ac56ac..1663620 100644 --- a/core/java/android/widget/Button.java +++ b/core/java/android/widget/Button.java @@ -103,8 +103,12 @@ public class Button extends TextView { this(context, attrs, com.android.internal.R.attr.buttonStyle); } - public Button(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public Button(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public Button(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java index de2be75..71e4e70 100644 --- a/core/java/android/widget/CalendarView.java +++ b/core/java/android/widget/CalendarView.java @@ -330,17 +330,21 @@ public class CalendarView extends FrameLayout { } public CalendarView(Context context, AttributeSet attrs) { - this(context, attrs, 0); + this(context, attrs, R.attr.calendarViewStyle); } - public CalendarView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, 0); + public CalendarView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public CalendarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); // initialization based on locale setCurrentLocale(Locale.getDefault()); - TypedArray attributesArray = context.obtainStyledAttributes(attrs, R.styleable.CalendarView, - R.attr.calendarViewStyle, 0); + final TypedArray attributesArray = context.obtainStyledAttributes( + attrs, R.styleable.CalendarView, defStyleAttr, defStyleRes); mShowWeekNumber = attributesArray.getBoolean(R.styleable.CalendarView_showWeekNumber, DEFAULT_SHOW_WEEK_NUMBER); mFirstDayOfWeek = attributesArray.getInt(R.styleable.CalendarView_firstDayOfWeek, diff --git a/core/java/android/widget/CheckBox.java b/core/java/android/widget/CheckBox.java index f1804f8..71438c9 100644 --- a/core/java/android/widget/CheckBox.java +++ b/core/java/android/widget/CheckBox.java @@ -64,8 +64,12 @@ public class CheckBox extends CompoundButton { this(context, attrs, com.android.internal.R.attr.checkboxStyle); } - public CheckBox(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public CheckBox(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public CheckBox(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index 40747f0..8a14d98 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -58,11 +58,15 @@ public class CheckedTextView extends TextView implements Checkable { this(context, attrs, R.attr.checkedTextViewStyle); } - public CheckedTextView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public CheckedTextView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public CheckedTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - R.styleable.CheckedTextView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.CheckedTextView, defStyleAttr, defStyleRes); Drawable d = a.getDrawable(R.styleable.CheckedTextView_checkMark); if (d != null) { diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java index b7a126e..f8d482d 100644 --- a/core/java/android/widget/Chronometer.java +++ b/core/java/android/widget/Chronometer.java @@ -96,12 +96,15 @@ public class Chronometer extends TextView { * Initialize with standard view layout information and style. * Sets the base to the current time. */ - public Chronometer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public Chronometer(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public Chronometer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes( - attrs, - com.android.internal.R.styleable.Chronometer, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.Chronometer, defStyleAttr, defStyleRes); setFormat(a.getString(com.android.internal.R.styleable.Chronometer_format)); a.recycle(); diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index 05a8dc8..da94082 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -64,12 +64,15 @@ public abstract class CompoundButton extends Button implements Checkable { this(context, attrs, 0); } - public CompoundButton(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public CompoundButton(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public CompoundButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = - context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.CompoundButton, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.CompoundButton, defStyleAttr, defStyleRes); Drawable d = a.getDrawable(com.android.internal.R.styleable.CompoundButton_button); if (d != null) { diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java index d03161e..90486b7 100644 --- a/core/java/android/widget/DatePicker.java +++ b/core/java/android/widget/DatePicker.java @@ -149,14 +149,18 @@ public class DatePicker extends FrameLayout { this(context, attrs, R.attr.datePickerStyle); } - public DatePicker(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public DatePicker(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public DatePicker(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); // initialization based on locale setCurrentLocale(Locale.getDefault()); - TypedArray attributesArray = context.obtainStyledAttributes(attrs, R.styleable.DatePicker, - defStyle, 0); + final TypedArray attributesArray = context.obtainStyledAttributes( + attrs, R.styleable.DatePicker, defStyleAttr, defStyleRes); boolean spinnersShown = attributesArray.getBoolean(R.styleable.DatePicker_spinnersShown, DEFAULT_SPINNERS_SHOWN); boolean calendarViewShown = attributesArray.getBoolean( diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java index 57e51c2..3a7cc87 100644 --- a/core/java/android/widget/EditText.java +++ b/core/java/android/widget/EditText.java @@ -56,8 +56,12 @@ public class EditText extends TextView { this(context, attrs, com.android.internal.R.attr.editTextStyle); } - public EditText(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public EditText(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public EditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 50d28ab..34eaac3 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -2321,8 +2321,8 @@ public class Editor { private final HashMap<SuggestionSpan, Integer> mSpansLengths; private class CustomPopupWindow extends PopupWindow { - public CustomPopupWindow(Context context, int defStyle) { - super(context, null, defStyle); + public CustomPopupWindow(Context context, int defStyleAttr) { + super(context, null, defStyleAttr); } @Override diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java index 7b81aa8..70089e0 100644 --- a/core/java/android/widget/ExpandableListView.java +++ b/core/java/android/widget/ExpandableListView.java @@ -227,12 +227,16 @@ public class ExpandableListView extends ListView { this(context, attrs, com.android.internal.R.attr.expandableListViewStyle); } - public ExpandableListView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ExpandableListView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ExpandableListView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = - context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.ExpandableListView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.ExpandableListView, defStyleAttr, defStyleRes); mGroupIndicator = a.getDrawable( com.android.internal.R.styleable.ExpandableListView_groupIndicator); diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index d9d4ad7..b029328 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -97,11 +97,15 @@ public class FrameLayout extends ViewGroup { this(context, attrs, 0); } - public FrameLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public FrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public FrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.FrameLayout, - defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.FrameLayout, defStyleAttr, defStyleRes); mForegroundGravity = a.getInt( com.android.internal.R.styleable.FrameLayout_foregroundGravity, mForegroundGravity); diff --git a/core/java/android/widget/Gallery.java b/core/java/android/widget/Gallery.java index 78ba6e0..f7c839f 100644 --- a/core/java/android/widget/Gallery.java +++ b/core/java/android/widget/Gallery.java @@ -196,14 +196,18 @@ public class Gallery extends AbsSpinner implements GestureDetector.OnGestureList this(context, attrs, R.attr.galleryStyle); } - public Gallery(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public Gallery(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public Gallery(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mGestureDetector = new GestureDetector(context, this); mGestureDetector.setIsLongpressEnabled(true); - - TypedArray a = context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.Gallery, defStyle, 0); + + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.Gallery, defStyleAttr, defStyleRes); int index = a.getInt(com.android.internal.R.styleable.Gallery_gravity, -1); if (index >= 0) { diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 54cc3f4..932dac3 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -265,10 +265,15 @@ public class GridLayout extends ViewGroup { /** * {@inheritDoc} */ - public GridLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public GridLayout(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public GridLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mDefaultGap = context.getResources().getDimensionPixelOffset(R.dimen.default_gap); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GridLayout); + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.GridLayout, defStyleAttr, defStyleRes); try { setRowCount(a.getInt(ROW_COUNT, DEFAULT_COUNT)); setColumnCount(a.getInt(COLUMN_COUNT, DEFAULT_COUNT)); diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index 15daf83..cf81476 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -110,11 +110,15 @@ public class GridView extends AbsListView { this(context, attrs, com.android.internal.R.attr.gridViewStyle); } - public GridView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public GridView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public GridView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.GridView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.GridView, defStyleAttr, defStyleRes); int hSpacing = a.getDimensionPixelOffset( com.android.internal.R.styleable.GridView_horizontalSpacing, 0); diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index dab0962..25d4f42 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -146,12 +146,17 @@ public class HorizontalScrollView extends FrameLayout { this(context, attrs, com.android.internal.R.attr.horizontalScrollViewStyle); } - public HorizontalScrollView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public HorizontalScrollView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public HorizontalScrollView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initScrollView(); - TypedArray a = context.obtainStyledAttributes(attrs, - android.R.styleable.HorizontalScrollView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, android.R.styleable.HorizontalScrollView, defStyleAttr, defStyleRes); setFillViewport(a.getBoolean(android.R.styleable.HorizontalScrollView_fillViewport, false)); diff --git a/core/java/android/widget/ImageButton.java b/core/java/android/widget/ImageButton.java index 379354c..207f505 100644 --- a/core/java/android/widget/ImageButton.java +++ b/core/java/android/widget/ImageButton.java @@ -83,8 +83,12 @@ public class ImageButton extends ImageView { this(context, attrs, com.android.internal.R.attr.imageButtonStyle); } - public ImageButton(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ImageButton(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ImageButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); setFocusable(true); } diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 3e53b91..251ecb2 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -117,12 +117,17 @@ public class ImageView extends View { this(context, attrs, 0); } - public ImageView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ImageView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + initImageView(); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.ImageView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ImageView, defStyleAttr, defStyleRes); Drawable d = a.getDrawable(com.android.internal.R.styleable.ImageView_src); if (d != null) { diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index ad60a95..9bae7b8 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -172,11 +172,15 @@ public class LinearLayout extends ViewGroup { this(context, attrs, 0); } - public LinearLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public LinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public LinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.LinearLayout, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.LinearLayout, defStyleAttr, defStyleRes); int index = a.getInt(com.android.internal.R.styleable.LinearLayout_orientation, -1); if (index >= 0) { diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 389d9d6..8852ad2 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -142,11 +142,15 @@ public class ListView extends AbsListView { this(context, attrs, com.android.internal.R.attr.listViewStyle); } - public ListView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ListView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.ListView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ListView, defStyleAttr, defStyleRes); CharSequence[] entries = a.getTextArray( com.android.internal.R.styleable.ListView_entries); diff --git a/core/java/android/widget/MultiAutoCompleteTextView.java b/core/java/android/widget/MultiAutoCompleteTextView.java index 0b30c84..cbd01b0 100644 --- a/core/java/android/widget/MultiAutoCompleteTextView.java +++ b/core/java/android/widget/MultiAutoCompleteTextView.java @@ -67,8 +67,13 @@ public class MultiAutoCompleteTextView extends AutoCompleteTextView { this(context, attrs, com.android.internal.R.attr.autoCompleteTextViewStyle); } - public MultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public MultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public MultiAutoCompleteTextView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } /* package */ void finishInit() { } diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index 19cc3c2..02491f4 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -559,14 +559,33 @@ public class NumberPicker extends LinearLayout { * * @param context the application environment. * @param attrs a collection of attributes. - * @param defStyle The default style to apply to this view. + * @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 NumberPicker(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public NumberPicker(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + /** + * Create a new number picker + * + * @param context the application environment. + * @param attrs a collection of attributes. + * @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 NumberPicker(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); // process style attributes - TypedArray attributesArray = context.obtainStyledAttributes( - attrs, R.styleable.NumberPicker, defStyle, 0); + final TypedArray attributesArray = context.obtainStyledAttributes( + attrs, R.styleable.NumberPicker, defStyleAttr, defStyleRes); final int layoutResId = attributesArray.getResourceId( R.styleable.NumberPicker_internalLayout, DEFAULT_LAYOUT_RESOURCE_ID); diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 1460737..2c1394e 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -167,8 +167,8 @@ public class PopupWindow { * * <p>The popup does provide a background.</p> */ - public PopupWindow(Context context, AttributeSet attrs, int defStyle) { - this(context, attrs, defStyle, 0); + public PopupWindow(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); } /** @@ -180,8 +180,7 @@ public class PopupWindow { mContext = context; mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); - TypedArray a = - context.obtainStyledAttributes( + final TypedArray a = context.obtainStyledAttributes( attrs, com.android.internal.R.styleable.PopupWindow, defStyleAttr, defStyleRes); mBackground = a.getDrawable(R.styleable.PopupWindow_popupBackground); diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index 65a2d4d..b0c2d28 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -242,20 +242,18 @@ public class ProgressBar extends View { this(context, attrs, com.android.internal.R.attr.progressBarStyle); } - public ProgressBar(Context context, AttributeSet attrs, int defStyle) { - this(context, attrs, defStyle, 0); + public ProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); } - /** - * @hide - */ - public ProgressBar(Context context, AttributeSet attrs, int defStyle, int styleRes) { - super(context, attrs, defStyle); + public ProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + mUiThreadId = Thread.currentThread().getId(); initProgressBar(); - TypedArray a = - context.obtainStyledAttributes(attrs, R.styleable.ProgressBar, defStyle, styleRes); + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.ProgressBar, defStyleAttr, defStyleRes); mNoInvalidate = true; diff --git a/core/java/android/widget/QuickContactBadge.java b/core/java/android/widget/QuickContactBadge.java index 368f6ad..9d90f32 100644 --- a/core/java/android/widget/QuickContactBadge.java +++ b/core/java/android/widget/QuickContactBadge.java @@ -84,8 +84,13 @@ public class QuickContactBadge extends ImageView implements OnClickListener { this(context, attrs, 0); } - public QuickContactBadge(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public QuickContactBadge(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public QuickContactBadge( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); TypedArray styledAttributes = mContext.obtainStyledAttributes(R.styleable.Theme); mOverlay = styledAttributes.getDrawable( diff --git a/core/java/android/widget/RadioButton.java b/core/java/android/widget/RadioButton.java index a0fef7d..46c6a54 100644 --- a/core/java/android/widget/RadioButton.java +++ b/core/java/android/widget/RadioButton.java @@ -59,8 +59,12 @@ public class RadioButton extends CompoundButton { this(context, attrs, com.android.internal.R.attr.radioButtonStyle); } - public RadioButton(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public RadioButton(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public RadioButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } /** diff --git a/core/java/android/widget/RatingBar.java b/core/java/android/widget/RatingBar.java index 4d3c56c..82b490e 100644 --- a/core/java/android/widget/RatingBar.java +++ b/core/java/android/widget/RatingBar.java @@ -82,11 +82,15 @@ public class RatingBar extends AbsSeekBar { private OnRatingBarChangeListener mOnRatingBarChangeListener; - public RatingBar(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RatingBar, - defStyle, 0); + public RatingBar(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public RatingBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.RatingBar, defStyleAttr, defStyleRes); final int numStars = a.getInt(R.styleable.RatingBar_numStars, mNumStars); setIsIndicator(a.getBoolean(R.styleable.RatingBar_isIndicator, !mIsUserSeekable)); final float rating = a.getFloat(R.styleable.RatingBar_rating, -1); diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 92c9b93..fe3216a 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -238,8 +238,14 @@ public class RelativeLayout extends ViewGroup { queryCompatibilityModes(context); } - public RelativeLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public RelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initFromAttributes(context, attrs); + queryCompatibilityModes(context); + } + + public RelativeLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initFromAttributes(context, attrs); queryCompatibilityModes(context); } diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 6680393..082d728 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -162,12 +162,16 @@ public class ScrollView extends FrameLayout { this(context, attrs, com.android.internal.R.attr.scrollViewStyle); } - public ScrollView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ScrollView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initScrollView(); - TypedArray a = - context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ScrollView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ScrollView, defStyleAttr, defStyleRes); setFillViewport(a.getBoolean(R.styleable.ScrollView_fillViewport, false)); diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index 0281602..3791258 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -242,7 +242,15 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { } public SearchView(Context context, AttributeSet attrs) { - super(context, attrs); + this(context, attrs, 0); + } + + public SearchView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public SearchView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -281,7 +289,8 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { } }); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SearchView, 0, 0); + TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.SearchView, defStyleAttr, defStyleRes); setIconifiedByDefault(a.getBoolean(R.styleable.SearchView_iconifiedByDefault, true)); int maxWidth = a.getDimensionPixelSize(R.styleable.SearchView_maxWidth, -1); if (maxWidth != -1) { @@ -304,7 +313,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { boolean focusable = true; - a = context.obtainStyledAttributes(attrs, R.styleable.View, 0, 0); + a = context.obtainStyledAttributes(attrs, R.styleable.View, defStyleAttr, defStyleRes); focusable = a.getBoolean(R.styleable.View_focusable, focusable); a.recycle(); setFocusable(focusable); @@ -1661,8 +1670,14 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { mThreshold = getThreshold(); } - public SearchAutoComplete(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public SearchAutoComplete(Context context, AttributeSet attrs, int defStyleAttrs) { + super(context, attrs, defStyleAttrs); + mThreshold = getThreshold(); + } + + public SearchAutoComplete( + Context context, AttributeSet attrs, int defStyleAttrs, int defStyleRes) { + super(context, attrs, defStyleAttrs, defStyleRes); mThreshold = getThreshold(); } diff --git a/core/java/android/widget/SeekBar.java b/core/java/android/widget/SeekBar.java index 2737f94..dc7c04c 100644 --- a/core/java/android/widget/SeekBar.java +++ b/core/java/android/widget/SeekBar.java @@ -79,8 +79,12 @@ public class SeekBar extends AbsSeekBar { this(context, attrs, com.android.internal.R.attr.seekBarStyle); } - public SeekBar(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public SeekBar(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public SeekBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/android/widget/SlidingDrawer.java b/core/java/android/widget/SlidingDrawer.java index 517246b..ec06c02 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; diff --git a/core/java/android/widget/Space.java b/core/java/android/widget/Space.java index bb53a77..068cfa0 100644 --- a/core/java/android/widget/Space.java +++ b/core/java/android/widget/Space.java @@ -30,8 +30,8 @@ public final class Space extends View { /** * {@inheritDoc} */ - public Space(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public Space(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); if (getVisibility() == VISIBLE) { setVisibility(INVISIBLE); } @@ -40,6 +40,13 @@ public final class Space extends View { /** * {@inheritDoc} */ + public Space(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + /** + * {@inheritDoc} + */ public Space(Context context, AttributeSet attrs) { this(context, attrs, 0); } diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index b87ed7a..0c83417 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -130,18 +130,17 @@ public class Spinner extends AbsSpinner implements OnClickListener { /** * Construct a new spinner with the given context's theme, the supplied attribute set, - * and default style. + * and default style attribute. * * @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 Spinner(Context context, AttributeSet attrs, int defStyle) { - this(context, attrs, defStyle, MODE_THEME); + public Spinner(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0, MODE_THEME); } /** @@ -152,20 +151,44 @@ public class Spinner extends AbsSpinner implements OnClickListener { * @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. * @param mode Constant describing how the user will select choices from the spinner. - * + * + * @see #MODE_DIALOG + * @see #MODE_DROPDOWN + */ + public Spinner(Context context, AttributeSet attrs, int defStyleAttr, int mode) { + this(context, attrs, defStyleAttr, 0, mode); + } + + /** + * Construct a new spinner with the given context's theme, the supplied attribute set, + * and default style. <code>mode</code> may be one of {@link #MODE_DIALOG} or + * {@link #MODE_DROPDOWN} and determines how the user will select choices from the spinner. + * + * @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 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. + * @param mode Constant describing how the user will select choices from the spinner. + * * @see #MODE_DIALOG * @see #MODE_DROPDOWN */ - public Spinner(Context context, AttributeSet attrs, int defStyle, int mode) { - super(context, attrs, defStyle); + public Spinner( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int mode) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Spinner, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.Spinner, defStyleAttr, defStyleRes); if (mode == MODE_THEME) { mode = a.getInt(com.android.internal.R.styleable.Spinner_spinnerMode, MODE_DIALOG); @@ -178,7 +201,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { } case MODE_DROPDOWN: { - final DropdownPopup popup = new DropdownPopup(context, attrs, defStyle); + final DropdownPopup popup = new DropdownPopup(context, attrs, defStyleAttr, defStyleRes); mDropDownWidth = a.getLayoutDimension( com.android.internal.R.styleable.Spinner_dropDownWidth, @@ -1027,8 +1050,9 @@ public class Spinner extends AbsSpinner implements OnClickListener { private CharSequence mHintText; private ListAdapter mAdapter; - public DropdownPopup(Context context, AttributeSet attrs, int defStyleRes) { - super(context, attrs, 0, defStyleRes); + public DropdownPopup( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); setAnchorView(Spinner.this); setModal(true); diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java index 6853660..d2e718c 100644 --- a/core/java/android/widget/StackView.java +++ b/core/java/android/widget/StackView.java @@ -168,9 +168,16 @@ public class StackView extends AdapterViewAnimator { * {@inheritDoc} */ public StackView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.StackView, defStyleAttr, 0); + this(context, attrs, defStyleAttr, 0); + } + + /** + * {@inheritDoc} + */ + public StackView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.StackView, defStyleAttr, defStyleRes); mResOutColor = a.getColor( com.android.internal.R.styleable.StackView_resOutColor, 0); diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index e754c17..065f985 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -139,19 +139,41 @@ public class Switch extends CompoundButton { * * @param context The Context that will determine this widget's theming. * @param attrs Specification of attributes that should deviate from the default styling. - * @param defStyle An attribute ID within the active theme containing a reference to the - * default style for this widget. e.g. android.R.attr.switchStyle. + * @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 Switch(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public Switch(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + + /** + * Construct a new Switch with a default style determined by the given theme + * attribute or style resource, overriding specific style attributes as + * requested. + * + * @param context The Context that will determine this widget's theming. + * @param attrs Specification of attributes that should deviate from the + * default styling. + * @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 Switch(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); Resources res = getResources(); mTextPaint.density = res.getDisplayMetrics().density; mTextPaint.setCompatibilityScaling(res.getCompatibilityInfo().applicationScale); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Switch, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.Switch, defStyleAttr, defStyleRes); mThumbDrawable = a.getDrawable(com.android.internal.R.styleable.Switch_thumb); mTrackDrawable = a.getDrawable(com.android.internal.R.styleable.Switch_track); diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 238dc55..89df51a 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -77,11 +77,18 @@ public class TabHost extends FrameLayout implements ViewTreeObserver.OnTouchMode } public TabHost(Context context, AttributeSet attrs) { + this(context, attrs, com.android.internal.R.attr.tabWidgetStyle); + } + + public TabHost(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public TabHost(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.TabWidget, - com.android.internal.R.attr.tabWidgetStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.TabWidget, defStyleAttr, defStyleRes); mTabLayoutId = a.getResourceId(R.styleable.TabWidget_tabLayout, 0); a.recycle(); diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java index 6bced1c..568b3e6 100644 --- a/core/java/android/widget/TabWidget.java +++ b/core/java/android/widget/TabWidget.java @@ -74,11 +74,15 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { this(context, attrs, com.android.internal.R.attr.tabWidgetStyle); } - public TabWidget(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public TabWidget(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public TabWidget(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); final TypedArray a = context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.TabWidget, defStyle, 0); + attrs, com.android.internal.R.styleable.TabWidget, defStyleAttr, defStyleRes); setStripEnabled(a.getBoolean(R.styleable.TabWidget_tabStripEnabled, true)); setLeftStripDrawable(a.getDrawable(R.styleable.TabWidget_tabStripLeft)); diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java index b3b95d9..4c5c71d 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); 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; diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java index cea2b8f..7926ab0 100644 --- a/core/java/android/widget/TimePicker.java +++ b/core/java/android/widget/TimePicker.java @@ -80,9 +80,13 @@ public class TimePicker extends FrameLayout { this(context, attrs, R.attr.timePickerStyle); } - public TimePicker(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - mDelegate = new LegacyTimePickerDelegate(this, context, attrs, defStyle); + public TimePicker(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public TimePicker(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + mDelegate = new LegacyTimePickerDelegate(this, context, attrs, defStyleAttr, defStyleRes); } /** @@ -294,15 +298,15 @@ public class TimePicker extends FrameLayout { }; public LegacyTimePickerDelegate(TimePicker delegator, Context context, AttributeSet attrs, - int defStyle) { + int defStyleAttr, int defStyleRes) { mDelegator = delegator; // initialization based on locale setCurrentLocale(Locale.getDefault()); // process style attributes - TypedArray attributesArray = context.obtainStyledAttributes( - attrs, R.styleable.TimePicker, defStyle, 0); + final TypedArray attributesArray = context.obtainStyledAttributes( + attrs, R.styleable.TimePicker, defStyleAttr, defStyleRes); int layoutResourceId = attributesArray.getResourceId( R.styleable.TimePicker_internalLayout, R.layout.time_picker); attributesArray.recycle(); diff --git a/core/java/android/widget/ToggleButton.java b/core/java/android/widget/ToggleButton.java index cedc777..28519d1 100644 --- a/core/java/android/widget/ToggleButton.java +++ b/core/java/android/widget/ToggleButton.java @@ -16,7 +16,6 @@ package android.widget; - import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; @@ -25,8 +24,6 @@ import android.util.AttributeSet; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; -import com.android.internal.R; - /** * Displays checked/unchecked states as a button * with a "light" indicator and by default accompanied with the text "ON" or "OFF". @@ -46,13 +43,12 @@ public class ToggleButton extends CompoundButton { private static final int NO_ALPHA = 0xFF; private float mDisabledAlpha; - - public ToggleButton(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - TypedArray a = - context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.ToggleButton, defStyle, 0); + + public ToggleButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.ToggleButton, defStyleAttr, defStyleRes); mTextOn = a.getText(com.android.internal.R.styleable.ToggleButton_textOn); mTextOff = a.getText(com.android.internal.R.styleable.ToggleButton_textOff); mDisabledAlpha = a.getFloat(com.android.internal.R.styleable.ToggleButton_disabledAlpha, 0.5f); @@ -60,6 +56,10 @@ public class ToggleButton extends CompoundButton { a.recycle(); } + public ToggleButton(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + public ToggleButton(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.buttonStyleToggle); } diff --git a/core/java/android/widget/TwoLineListItem.java b/core/java/android/widget/TwoLineListItem.java index f7e5266..5606c60 100644 --- a/core/java/android/widget/TwoLineListItem.java +++ b/core/java/android/widget/TwoLineListItem.java @@ -56,11 +56,15 @@ public class TwoLineListItem extends RelativeLayout { this(context, attrs, 0); } - public TwoLineListItem(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public TwoLineListItem(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public TwoLineListItem(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.TwoLineListItem, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.TwoLineListItem, defStyleAttr, defStyleRes); a.recycle(); } diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java index 009b729..e7ff743 100644 --- a/core/java/android/widget/VideoView.java +++ b/core/java/android/widget/VideoView.java @@ -116,8 +116,12 @@ public class VideoView extends SurfaceView initVideoView(); } - public VideoView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public VideoView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public VideoView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initVideoView(); } diff --git a/core/java/android/widget/ZoomButton.java b/core/java/android/widget/ZoomButton.java index af17c94..715e868 100644 --- a/core/java/android/widget/ZoomButton.java +++ b/core/java/android/widget/ZoomButton.java @@ -49,8 +49,12 @@ public class ZoomButton extends ImageButton implements OnLongClickListener { this(context, attrs, 0); } - public ZoomButton(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ZoomButton(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ZoomButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); mHandler = new Handler(); setOnLongClickListener(this); } diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java index fe532b0..10b98d8 100644 --- a/core/java/com/android/internal/app/AlertController.java +++ b/core/java/com/android/internal/app/AlertController.java @@ -736,8 +736,13 @@ public class AlertController { super(context, attrs); } - public RecycleListView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public RecycleListView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public RecycleListView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/com/android/internal/preference/YesNoPreference.java b/core/java/com/android/internal/preference/YesNoPreference.java index cf68a58..61d1d75 100644 --- a/core/java/com/android/internal/preference/YesNoPreference.java +++ b/core/java/com/android/internal/preference/YesNoPreference.java @@ -32,8 +32,12 @@ import android.util.AttributeSet; public class YesNoPreference extends DialogPreference { private boolean mWasPositiveResult; - public YesNoPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public YesNoPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public YesNoPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } public YesNoPreference(Context context, AttributeSet attrs) { diff --git a/core/java/com/android/internal/view/CheckableLinearLayout.java b/core/java/com/android/internal/view/CheckableLinearLayout.java index 3fb7cec..1a57e4e 100644 --- a/core/java/com/android/internal/view/CheckableLinearLayout.java +++ b/core/java/com/android/internal/view/CheckableLinearLayout.java @@ -37,8 +37,14 @@ public class CheckableLinearLayout extends LinearLayout implements Checkable { // TODO Auto-generated constructor stub } - public CheckableLinearLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public CheckableLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + // TODO Auto-generated constructor stub + } + + public CheckableLinearLayout( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); // TODO Auto-generated constructor stub } diff --git a/core/java/com/android/internal/view/menu/ActionMenuItemView.java b/core/java/com/android/internal/view/menu/ActionMenuItemView.java index 238a9c0..c14d587 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuItemView.java +++ b/core/java/com/android/internal/view/menu/ActionMenuItemView.java @@ -60,13 +60,17 @@ public class ActionMenuItemView extends TextView this(context, attrs, 0); } - public ActionMenuItemView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public ActionMenuItemView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ActionMenuItemView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); final Resources res = context.getResources(); mAllowTextWithIcon = res.getBoolean( com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.ActionMenuItemView, 0, 0); + final TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.ActionMenuItemView, defStyleAttr, defStyleRes); mMinWidth = a.getDimensionPixelSize( com.android.internal.R.styleable.ActionMenuItemView_minWidth, 0); a.recycle(); diff --git a/core/java/com/android/internal/view/menu/IconMenuItemView.java b/core/java/com/android/internal/view/menu/IconMenuItemView.java index 5d0b25f..de5e279 100644 --- a/core/java/com/android/internal/view/menu/IconMenuItemView.java +++ b/core/java/com/android/internal/view/menu/IconMenuItemView.java @@ -57,8 +57,8 @@ public final class IconMenuItemView extends TextView implements MenuView.ItemVie private static String sPrependShortcutLabel; - public IconMenuItemView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs); + public IconMenuItemView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); if (sPrependShortcutLabel == null) { /* @@ -68,10 +68,9 @@ public final class IconMenuItemView extends TextView implements MenuView.ItemVie sPrependShortcutLabel = getResources().getString( com.android.internal.R.string.prepend_shortcut_label); } - - TypedArray a = - context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.MenuView, defStyle, 0); + + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.MenuView, defStyleAttr, defStyleRes); mDisabledAlpha = a.getFloat( com.android.internal.R.styleable.MenuView_itemIconDisabledAlpha, 0.8f); @@ -81,7 +80,11 @@ public final class IconMenuItemView extends TextView implements MenuView.ItemVie a.recycle(); } - + + public IconMenuItemView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + public IconMenuItemView(Context context, AttributeSet attrs) { this(context, attrs, 0); } diff --git a/core/java/com/android/internal/view/menu/ListMenuItemView.java b/core/java/com/android/internal/view/menu/ListMenuItemView.java index a2a4acc..692bdac 100644 --- a/core/java/com/android/internal/view/menu/ListMenuItemView.java +++ b/core/java/com/android/internal/view/menu/ListMenuItemView.java @@ -55,13 +55,13 @@ public class ListMenuItemView extends LinearLayout implements MenuView.ItemView private boolean mForceShowIcon; - public ListMenuItemView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs); - - TypedArray a = - context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.MenuView, defStyle, 0); - + public ListMenuItemView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes( + attrs, com.android.internal.R.styleable.MenuView, defStyleAttr, defStyleRes); + mBackground = a.getDrawable(com.android.internal.R.styleable.MenuView_itemBackground); mTextAppearance = a.getResourceId(com.android.internal.R.styleable. MenuView_itemTextAppearance, -1); @@ -72,6 +72,10 @@ public class ListMenuItemView extends LinearLayout implements MenuView.ItemView a.recycle(); } + public ListMenuItemView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + public ListMenuItemView(Context context, AttributeSet attrs) { this(context, attrs, 0); } diff --git a/core/java/com/android/internal/widget/AbsActionBarView.java b/core/java/com/android/internal/widget/AbsActionBarView.java index ca7f5d0..470ef29 100644 --- a/core/java/com/android/internal/widget/AbsActionBarView.java +++ b/core/java/com/android/internal/widget/AbsActionBarView.java @@ -54,8 +54,13 @@ public abstract class AbsActionBarView extends ViewGroup { super(context, attrs); } - public AbsActionBarView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public AbsActionBarView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public AbsActionBarView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java index 8bc1081..b34b541 100644 --- a/core/java/com/android/internal/widget/ActionBarContextView.java +++ b/core/java/com/android/internal/widget/ActionBarContextView.java @@ -74,10 +74,16 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi this(context, attrs, com.android.internal.R.attr.actionModeStyle); } - public ActionBarContextView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionMode, defStyle, 0); + public ActionBarContextView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public ActionBarContextView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.ActionMode, defStyleAttr, defStyleRes); setBackgroundDrawable(a.getDrawable( com.android.internal.R.styleable.ActionMode_background)); mTitleStyleRes = a.getResourceId( diff --git a/core/java/com/android/internal/widget/DialogTitle.java b/core/java/com/android/internal/widget/DialogTitle.java index b86c438..7ea3d6b 100644 --- a/core/java/com/android/internal/widget/DialogTitle.java +++ b/core/java/com/android/internal/widget/DialogTitle.java @@ -28,10 +28,13 @@ import android.widget.TextView; * the text to the available space. */ public class DialogTitle extends TextView { - - public DialogTitle(Context context, AttributeSet attrs, - int defStyle) { - super(context, attrs, defStyle); + + public DialogTitle(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + public DialogTitle(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); } public DialogTitle(Context context, AttributeSet attrs) { diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java b/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java index b37adff..d27346b 100644 --- a/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java +++ b/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java @@ -29,11 +29,16 @@ public class PasswordEntryKeyboardView extends KeyboardView { static final int KEYCODE_NEXT_LANGUAGE = -104; public PasswordEntryKeyboardView(Context context, AttributeSet attrs) { - super(context, attrs); + this(context, attrs, 0); } - public PasswordEntryKeyboardView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public PasswordEntryKeyboardView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public PasswordEntryKeyboardView( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); } @Override diff --git a/core/java/com/android/internal/widget/SizeAdaptiveLayout.java b/core/java/com/android/internal/widget/SizeAdaptiveLayout.java index ba113a3..a568dfc 100644 --- a/core/java/com/android/internal/widget/SizeAdaptiveLayout.java +++ b/core/java/com/android/internal/widget/SizeAdaptiveLayout.java @@ -88,8 +88,14 @@ public class SizeAdaptiveLayout extends ViewGroup { initialize(); } - public SizeAdaptiveLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public SizeAdaptiveLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initialize(); + } + + public SizeAdaptiveLayout( + Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); initialize(); } diff --git a/core/java/com/android/internal/widget/SubtitleView.java b/core/java/com/android/internal/widget/SubtitleView.java index 356401c..7523b9e 100644 --- a/core/java/com/android/internal/widget/SubtitleView.java +++ b/core/java/com/android/internal/widget/SubtitleView.java @@ -82,12 +82,15 @@ public class SubtitleView extends View { this(context, attrs, 0); } - public SubtitleView(Context context, AttributeSet attrs, int defStyle) { + public SubtitleView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public SubtitleView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs); - final Theme theme = context.getTheme(); - final TypedArray a = theme.obtainStyledAttributes( - attrs, android.R.styleable.TextView, defStyle, 0); + final TypedArray a = context.obtainStyledAttributes( + attrs, android.R.styleable.TextView, defStyleAttr, defStyleRes); CharSequence text = ""; int textSize = 15; diff --git a/core/java/com/android/internal/widget/TextProgressBar.java b/core/java/com/android/internal/widget/TextProgressBar.java index e898aa4..48003c0 100644 --- a/core/java/com/android/internal/widget/TextProgressBar.java +++ b/core/java/com/android/internal/widget/TextProgressBar.java @@ -59,9 +59,13 @@ public class TextProgressBar extends RelativeLayout implements OnChronometerTick boolean mChronometerFollow = false; int mChronometerGravity = Gravity.NO_GRAVITY; + + public TextProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } - public TextProgressBar(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public TextProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); } public TextProgressBar(Context context, AttributeSet attrs) { diff --git a/media/java/android/media/WebVttRenderer.java b/media/java/android/media/WebVttRenderer.java index 74773a8..f3c8b3d 100644 --- a/media/java/android/media/WebVttRenderer.java +++ b/media/java/android/media/WebVttRenderer.java @@ -1135,8 +1135,12 @@ class WebVttRenderingWidget extends ViewGroup implements SubtitleTrack.Rendering this(context, null, 0); } - public WebVttRenderingWidget(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + public WebVttRenderingWidget(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public WebVttRenderingWidget(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); // Cannot render text over video when layer type is hardware. setLayerType(View.LAYER_TYPE_SOFTWARE, null); |