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

Commit f3c2edaa authored by Adam Powell's avatar Adam Powell
Browse files

Make AbsListViews remeasure children after rotation

Fixes issues in Settings and other places where TextView separators
aren't resized properly after a rotation

Change-Id: Id5c53d4c5e6621e79e723ec2c300c8a43f12e379
parent 4889fb75
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -1160,6 +1160,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);
        mInLayout = true;
        if (changed) {
            int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                getChildAt(i).forceLayout();
            }
            mRecycler.markChildrenDirty();
        }

        layoutChildren();
        mInLayout = false;
        
@@ -4143,6 +4151,25 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            mScrapViews = scrapViews;
        }
        
        public void markChildrenDirty() {
            if (mViewTypeCount == 1) {
                final ArrayList<View> scrap = mCurrentScrap;
                final int scrapCount = scrap.size();
                for (int i = 0; i < scrapCount; i++) {
                    scrap.get(i).forceLayout();
                }
            } else {
                final int typeCount = mViewTypeCount;
                for (int i = 0; i < typeCount; i++) {
                    final ArrayList<View> scrap = mScrapViews[i];
                    final int scrapCount = scrap.size();
                    for (int j = 0; j < scrapCount; j++) {
                        scrap.get(j).forceLayout();
                    }
                }
            }
        }

        public boolean shouldRecycleViewType(int viewType) {
            return viewType >= 0;
        }