Merge "Fix drop down layout inflation in ThemedSpinnerAdapter classes" into mnc-dev

This commit is contained in:
Alan Viverette
2015-06-03 23:48:40 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 14 deletions

View File

@@ -51,12 +51,6 @@ import java.util.List;
* override {@link #getView(int, View, ViewGroup)} to return the type of view you want.
*/
public class ArrayAdapter<T> extends BaseAdapter implements Filterable, ThemedSpinnerAdapter {
/**
* Contains the list of objects that represent the data of this ArrayAdapter.
* The content of this list is referred to as "the array" in the documentation.
*/
private List<T> mObjects;
/**
* Lock used to modify the content of {@link #mObjects}. Any write operation
* performed on the array should be synchronized on this lock. This lock is also
@@ -65,6 +59,14 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable, ThemedSp
*/
private final Object mLock = new Object();
private final LayoutInflater mInflater;
/**
* Contains the list of objects that represent the data of this ArrayAdapter.
* The content of this list is referred to as "the array" in the documentation.
*/
private List<T> mObjects;
/**
* The resource indicating what views to inflate to display the content of this
* array adapter.
@@ -97,8 +99,6 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable, ThemedSp
private ArrayList<T> mOriginalValues;
private ArrayFilter mFilter;
private LayoutInflater mInflater;
/** Layout inflater used for {@link #getDropDownView(int, View, ViewGroup)}. */
private LayoutInflater mDropDownInflater;
@@ -442,9 +442,6 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable, ThemedSp
return mDropDownInflater == null ? null : mDropDownInflater.getContext().getTheme();
}
/**
* {@inheritDoc}
*/
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
final LayoutInflater inflater = mDropDownInflater == null ? mInflater : mDropDownInflater;

View File

@@ -52,6 +52,8 @@ import java.util.Map;
* If no appropriate binding can be found, an {@link IllegalStateException} is thrown.
*/
public class SimpleAdapter extends BaseAdapter implements Filterable, ThemedSpinnerAdapter {
private final LayoutInflater mInflater;
private int[] mTo;
private String[] mFrom;
private ViewBinder mViewBinder;
@@ -60,7 +62,6 @@ public class SimpleAdapter extends BaseAdapter implements Filterable, ThemedSpin
private int mResource;
private int mDropDownResource;
private LayoutInflater mInflater;
/** Layout inflater used for {@link #getDropDownView(int, View, ViewGroup)}. */
private LayoutInflater mDropDownInflater;
@@ -174,8 +175,8 @@ public class SimpleAdapter extends BaseAdapter implements Filterable, ThemedSpin
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return createViewFromResource(
mDropDownInflater, position, convertView, parent, mDropDownResource);
final LayoutInflater inflater = mDropDownInflater == null ? mInflater : mDropDownInflater;
return createViewFromResource(inflater, position, convertView, parent, mDropDownResource);
}
private void bindView(int position, View view) {