Merge "Handle negative view types properly in getScrapView" into mnc-dev

This commit is contained in:
Yigit Boyar
2015-06-17 17:58:24 +00:00
committed by Android (Google) Code Review

View File

@@ -6575,13 +6575,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
* @return A view from the ScrapViews collection. These are unordered. * @return A view from the ScrapViews collection. These are unordered.
*/ */
View getScrapView(int position) { View getScrapView(int position) {
final int whichScrap = mAdapter.getItemViewType(position);
if (whichScrap < 0) {
return null;
}
if (mViewTypeCount == 1) { if (mViewTypeCount == 1) {
return retrieveFromScrap(mCurrentScrap, position); return retrieveFromScrap(mCurrentScrap, position);
} else { } else if (whichScrap < mScrapViews.length) {
final int whichScrap = mAdapter.getItemViewType(position); return retrieveFromScrap(mScrapViews[whichScrap], position);
if (whichScrap >= 0 && whichScrap < mScrapViews.length) {
return retrieveFromScrap(mScrapViews[whichScrap], position);
}
} }
return null; return null;
} }