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

Commit 2b460d08 authored by Alan Viverette's avatar Alan Viverette
Browse files

Remember focused child during layout when adapter has stable IDs

Ensures behavior is consistent between accessibility focus retention and
keyboard focus retention. Attempts to retain focus when possible.

Bug: 22207825
Change-Id: I62360892f52d456e2128f93a2dbf18f2bc934ef3
parent 401aa9d8
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1621,7 +1621,8 @@ public class ListView extends AbsListView {
                // We can remember the focused view to restore after re-layout
                // We can remember the focused view to restore after re-layout
                // if the data hasn't changed, or if the focused position is a
                // if the data hasn't changed, or if the focused position is a
                // header or footer.
                // header or footer.
                if (!dataChanged || isDirectChildHeaderOrFooter(focusedChild)) {
                if (!dataChanged || isDirectChildHeaderOrFooter(focusedChild)
                        || focusedChild.hasTransientState() || mAdapterHasStableIds) {
                    focusLayoutRestoreDirectChild = focusedChild;
                    focusLayoutRestoreDirectChild = focusedChild;
                    // Remember the specific view that had focus.
                    // Remember the specific view that had focus.
                    focusLayoutRestoreView = findFocus();
                    focusLayoutRestoreView = findFocus();