Skip to content

Commit

Permalink
Do not keep searching across all items
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensousa committed Oct 7, 2024
1 parent 3eee9c5 commit 689a898
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ internal class DefaultFocusInterceptor(
): View? {
var currentPosition = fromPosition
while (currentPosition >= 0 && currentPosition < layoutInfo.getItemCount()) {
val view = layoutInfo.findViewByPosition(currentPosition)
if (view != null && layoutInfo.isViewFocusable(view)) {
// Exit early if we've exhausted the current layout structure
val view = layoutInfo.findViewByPosition(currentPosition) ?: return null
if (layoutInfo.isViewFocusable(view)) {
return view
}
currentPosition += positionIncrement
Expand Down

0 comments on commit 689a898

Please sign in to comment.