summaryrefslogtreecommitdiff
path: root/core/java/android/widget/SearchView.java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2013-09-09 18:09:13 -0700
committerAlan Viverette <alanv@google.com>2013-09-09 18:09:13 -0700
commit617feb99a06e7ffb3894e86a286bf30e085f321a (patch)
tree81366597a0234fc7634effbf7cf9d13e2c5c69e2 /core/java/android/widget/SearchView.java
parente668c0a1759d35ce3156bcd830ed07d3fddd2ce4 (diff)
Add View constructor that supplies a default style resource
Also updates the constructor of every class that extends View. BUG: 10676369 Change-Id: Ifaf27bf82028d180afa4931c0e906df88d858ac3
Diffstat (limited to 'core/java/android/widget/SearchView.java')
-rw-r--r--core/java/android/widget/SearchView.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 02816023ccfc..37912585b978 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();
}