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

Commit bcefcb5e authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by The Android Open Source Project
Browse files

am c5f1b92d: Merge change 691 into donut

Merge commit 'c5f1b92d'

* commit 'c5f1b92d':
  Fixes 1819406. Take a ListView, add headers/footers, set the adapter after at least one layout pass, and the headers/footers don't know they have a parent anymore. Which causes a lot of trouble, like drawing not happening.
parents bff1389c c5f1b92d
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -460,10 +460,30 @@ public class ListView extends AbsListView {
     */
    @Override
    void resetList() {
        // The parent's resetList() will remove all views from the layout so we need to
        // cleanup the state of our footers and headers
        clearRecycledState(mHeaderViewInfos);
        clearRecycledState(mFooterViewInfos);

        super.resetList();

        mLayoutMode = LAYOUT_NORMAL;
    }

    private void clearRecycledState(ArrayList<FixedViewInfo> infos) {
        if (infos != null) {
            final int count = infos.size();

            for (int i = 0; i < count; i++) {
                final View child = infos.get(i).view;
                final LayoutParams p = (LayoutParams) child.getLayoutParams();
                if (p != null) {
                    p.recycledHeaderFooter = false;
                }
            }
        }
    }

    /**
     * @return Whether the list needs to show the top fading edge
     */