Skip to content

Commit

Permalink
Fix searching during animations case
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensousa committed Oct 8, 2024
1 parent db8a9a5 commit e4519c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ internal class LayoutConfiguration(properties: Properties) {
var isFocusSearchDisabled = false
private set

private var isFocusSearchEnabledDuringAnimations = false
var isFocusSearchEnabledDuringAnimations = false
private set

// Number of items to prefetch when first coming on screen with new data
var initialPrefetchItemCount = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ internal class FocusDispatcher(
return currentRecyclerView.parent?.focusSearch(focused, direction)
}

if (!configuration.isFocusSearchEnabledDuringAnimations
&& currentRecyclerView.isAnimating
) {
return focused
}

// Get the new focus direction and exit early if none is valid
val focusDirection: FocusDirection = FocusDirection.from(
direction = direction,
Expand Down

0 comments on commit e4519c0

Please sign in to comment.