Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Gesture Handler limits on Android #2672

Merged
merged 6 commits into from
Nov 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class GestureHandlerOrchestrator(
private val gestureHandlers = arrayListOf<GestureHandler<*>>()
private val awaitingHandlers = arrayListOf<GestureHandler<*>>()
private val preparedHandlers = arrayListOf<GestureHandler<*>>()
private val handlersToCancel = arrayListOf<GestureHandler<*>>()
private var isHandlingTouch = false
private var handlingChangeSemaphore = 0
private var finishedHandlersCleanupScheduled = false
Expand Down Expand Up @@ -160,19 +159,12 @@ class GestureHandlerOrchestrator(
activationIndex = [email protected]++
}

// Cancel all handlers that are required to be cancel upon current handler's activation
for (otherHandler in gestureHandlers) {
for (otherHandler in gestureHandlers.reversed()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (otherHandler in gestureHandlers.reversed()) {
for (otherHandler in gestureHandlers.asReversed()) {

I don't think the list is being mutated here, so we shouldn't need a copy.

if (shouldHandlerBeCancelledBy(otherHandler, handler)) {
handlersToCancel.add(otherHandler)
otherHandler.cancel()
}
}

for (otherHandler in handlersToCancel.reversed()) {
otherHandler.cancel()
}

handlersToCancel.clear()

// Clear all awaiting handlers waiting for the current handler to fail
for (otherHandler in awaitingHandlers.reversed()) {
if (shouldHandlerBeCancelledBy(otherHandler, handler)) {
Expand Down
Loading