Loading core/java/android/widget/Spinner.java +21 −9 Original line number Original line Diff line number Diff line Loading @@ -295,14 +295,18 @@ public class Spinner extends AbsSpinner implements OnClickListener { */ */ private static class DropDownAdapter implements ListAdapter, SpinnerAdapter { private static class DropDownAdapter implements ListAdapter, SpinnerAdapter { private SpinnerAdapter mAdapter; private SpinnerAdapter mAdapter; private ListAdapter mListAdapter; /** /** * <p>Creates a new ListAddapter wrapper for the specified adapter.</p> * <p>Creates a new ListAdapter wrapper for the specified adapter.</p> * * * @param adapter the Adapter to transform into a ListAdapter * @param adapter the Adapter to transform into a ListAdapter */ */ public DropDownAdapter(SpinnerAdapter adapter) { public DropDownAdapter(SpinnerAdapter adapter) { this.mAdapter = adapter; this.mAdapter = adapter; if (adapter instanceof ListAdapter) { this.mListAdapter = (ListAdapter) adapter; } } } public int getCount() { public int getCount() { Loading Loading @@ -343,22 +347,30 @@ public class Spinner extends AbsSpinner implements OnClickListener { } } /** /** * <p>Always returns false.</p> * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. * * Otherwise, return true. * @return false */ */ public boolean areAllItemsEnabled() { public boolean areAllItemsEnabled() { final ListAdapter adapter = mListAdapter; if (adapter != null) { return adapter.areAllItemsEnabled(); } else { return true; return true; } } } /** /** * <p>Always returns false.</p> * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. * * Otherwise, return true. * @return false */ */ public boolean isEnabled(int position) { public boolean isEnabled(int position) { final ListAdapter adapter = mListAdapter; if (adapter != null) { return adapter.isEnabled(position); } else { return true; return true; } } } public int getItemViewType(int position) { public int getItemViewType(int position) { return 0; return 0; Loading Loading
core/java/android/widget/Spinner.java +21 −9 Original line number Original line Diff line number Diff line Loading @@ -295,14 +295,18 @@ public class Spinner extends AbsSpinner implements OnClickListener { */ */ private static class DropDownAdapter implements ListAdapter, SpinnerAdapter { private static class DropDownAdapter implements ListAdapter, SpinnerAdapter { private SpinnerAdapter mAdapter; private SpinnerAdapter mAdapter; private ListAdapter mListAdapter; /** /** * <p>Creates a new ListAddapter wrapper for the specified adapter.</p> * <p>Creates a new ListAdapter wrapper for the specified adapter.</p> * * * @param adapter the Adapter to transform into a ListAdapter * @param adapter the Adapter to transform into a ListAdapter */ */ public DropDownAdapter(SpinnerAdapter adapter) { public DropDownAdapter(SpinnerAdapter adapter) { this.mAdapter = adapter; this.mAdapter = adapter; if (adapter instanceof ListAdapter) { this.mListAdapter = (ListAdapter) adapter; } } } public int getCount() { public int getCount() { Loading Loading @@ -343,22 +347,30 @@ public class Spinner extends AbsSpinner implements OnClickListener { } } /** /** * <p>Always returns false.</p> * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. * * Otherwise, return true. * @return false */ */ public boolean areAllItemsEnabled() { public boolean areAllItemsEnabled() { final ListAdapter adapter = mListAdapter; if (adapter != null) { return adapter.areAllItemsEnabled(); } else { return true; return true; } } } /** /** * <p>Always returns false.</p> * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. * * Otherwise, return true. * @return false */ */ public boolean isEnabled(int position) { public boolean isEnabled(int position) { final ListAdapter adapter = mListAdapter; if (adapter != null) { return adapter.isEnabled(position); } else { return true; return true; } } } public int getItemViewType(int position) { public int getItemViewType(int position) { return 0; return 0; Loading