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

Commit 9c3184cc authored by Romain Guy's avatar Romain Guy
Browse files

Do not recyle headers and footers when measuring the ListView.

Bug #2461893

This was causing headers and footers to be in a wrong state after the first
recycling pass, which would cause them to be detached from the window. This
was in turn preventing invalidate operations from performing successfully.
parent 3f3e53bc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4157,7 +4157,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                View child = getChildAt(i);
                AbsListView.LayoutParams lp = (AbsListView.LayoutParams) child.getLayoutParams();
                // Don't put header or footer views into the scrap heap
                if (lp != null && lp.viewType != AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
                if (lp != null && lp.viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
                    // Note:  We do place AdapterView.ITEM_VIEW_TYPE_IGNORE in active views.
                    //        However, we will NOT place them into scrap views.
                    activeViews[i] = child;
+5 −3
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ public class ListView extends AbsListView {

    // the single allocated result per list view; kinda cheesey but avoids
    // allocating these thingies too often.
    private ArrowScrollFocusResult mArrowScrollFocusResult = new ArrowScrollFocusResult();
    private final ArrowScrollFocusResult mArrowScrollFocusResult = new ArrowScrollFocusResult();

    public ListView(Context context) {
        this(context, null);
@@ -1040,7 +1040,8 @@ public class ListView extends AbsListView {
            childWidth = child.getMeasuredWidth();
            childHeight = child.getMeasuredHeight();

            if (recycleOnMeasure()) {
            if (recycleOnMeasure() && mRecycler.shouldRecycleViewType(
                    ((LayoutParams) child.getLayoutParams()).viewType)) {
                mRecycler.addScrapView(child);
            }
        }
@@ -1155,7 +1156,8 @@ public class ListView extends AbsListView {
            }

            // Recycle the view before we possibly return from the method
            if (recyle) {
            if (recyle && recycleBin.shouldRecycleViewType(
                    ((LayoutParams) child.getLayoutParams()).viewType)) {
                recycleBin.addScrapView(child);
            }