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

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

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

when gaining focus

Change-Id: I9b82cba3d48a211b1d2017d66791bea466938cab
parent 1759af3b
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();
        }