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

Skip to content
Commit 1ea68891 authored by Mark Brophy's avatar Mark Brophy
Browse files

Fix exception when a focused item is detached.

When a ListView has itemsCanFocus set, and scrolling moves the currently
focused item off the display, its focus is cleared. This is checked by
calling getDistanceToView().

However, it's possible that the view will have been recycled.  If so, it
will have been detached from the parent by calling
ViewGroup.detachViewFromParent.  Since this doesn't clear the view's
focus, we'll still try to call getDistanceFromView(), causing an
IllegalArgumentException since the view is not a descendant of the
ListView anymore.

Check whether the view is still a descendant before calling
getDistanceToView(). If it's not, we also need to clear the focus.

Bug: 4556022
Change-Id: Iebee56032223b70d714e2ec3bb7a19093ab5f81c
parent ae65c179
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment