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

Commit b1db20bd authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 5514022 - ListView should not auto-scroll selected item to top...

Merge "Fix bug 5514022 - ListView should not auto-scroll selected item to top when gaining focus" into ics-mr1
parents af3a854b dcce1216
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3361,6 +3361,7 @@ public class ListView extends AbsListView {

        final ListAdapter adapter = mAdapter;
        int closetChildIndex = -1;
        int closestChildTop = 0;
        if (adapter != null && gainFocus && previouslyFocusedRect != null) {
            previouslyFocusedRect.offset(mScrollX, mScrollY);

@@ -3392,12 +3393,13 @@ public class ListView extends AbsListView {
                if (distance < minDistance) {
                    minDistance = distance;
                    closetChildIndex = i;
                    closestChildTop = other.getTop();
                }
            }
        }

        if (closetChildIndex >= 0) {
            setSelection(closetChildIndex + mFirstPosition);
            setSelectionFromTop(closetChildIndex + mFirstPosition, closestChildTop);
        } else {
            requestLayout();
        }