Handle negative view types properly in getScrapView
ListView had a bug where it would pass wrong view to the adapter if adapter is using HEADER or IGNORE types for views. This CL fixes that issue and ensures that ListView will not try to search scrap view lists for these views which are never recycled. Bug: 19409057 Change-Id: I2653bbca93fbaf48567b47d10f273c8921d59bd2
This commit is contained in:
@@ -6575,13 +6575,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
* @return A view from the ScrapViews collection. These are unordered.
|
||||
*/
|
||||
View getScrapView(int position) {
|
||||
final int whichScrap = mAdapter.getItemViewType(position);
|
||||
if (whichScrap < 0) {
|
||||
return null;
|
||||
}
|
||||
if (mViewTypeCount == 1) {
|
||||
return retrieveFromScrap(mCurrentScrap, position);
|
||||
} else {
|
||||
final int whichScrap = mAdapter.getItemViewType(position);
|
||||
if (whichScrap >= 0 && whichScrap < mScrapViews.length) {
|
||||
return retrieveFromScrap(mScrapViews[whichScrap], position);
|
||||
}
|
||||
} else if (whichScrap < mScrapViews.length) {
|
||||
return retrieveFromScrap(mScrapViews[whichScrap], position);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user