Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f85e6739 authored by Yigit Boyar's avatar Yigit Boyar
Browse files

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
parent e1debb75
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -6575,14 +6575,15 @@ 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) {
            } else if (whichScrap < mScrapViews.length) {
                return retrieveFromScrap(mScrapViews[whichScrap], position);
            }
            }
            return null;
        }