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

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

Don't cache mFirstPosition before a layoutChildren in ListView.onFocusChanged

parent bcbf564a
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -3092,9 +3092,9 @@ public class ListView extends AbsListView {
            previouslyFocusedRect.offset(mScrollX, mScrollY);

            final ListAdapter adapter = mAdapter;
            final int firstPosition = mFirstPosition;
            // Don't cache the result of getChildCount here, it could change in layoutChildren.
            if (adapter.getCount() < getChildCount() + firstPosition) {
            // Don't cache the result of getChildCount or mFirstPosition here,
            // it could change in layoutChildren.
            if (adapter.getCount() < getChildCount() + mFirstPosition) {
                mLayoutMode = LAYOUT_NORMAL;
                layoutChildren();
            }
@@ -3104,6 +3104,7 @@ public class ListView extends AbsListView {
            Rect otherRect = mTempRect;
            int minDistance = Integer.MAX_VALUE;
            final int childCount = getChildCount();
            final int firstPosition = mFirstPosition;

            for (int i = 0; i < childCount; i++) {
                // only consider selectable views