Fix nested buttons on Android and buttons becoming unresponsive in a list #2187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Should fix #2160
This PR changes the logic of responder by splitting it in two: one for sound and one for touch exclusivity. Button can become the touch responder when
setPressed
method is called withpressed
set totrue
and it also is the touch responder. The sound responder is freed in theperformClick
method - after that pointsetPressed
should only be called withpressed
set tofalse
for existing pointers. This prevents the sound effect from being played more than one time when pressing on nested buttons.It also adds more ways to free the responder: it reverts a change from a while back that frees responder on gesture end and frees the responder when button holding it receives
POINTER_CANCEL
event. Because of that, the responder should always be freed correctly, preventing the buttons from becoming unresponsive.Test plan
Tested on the example app (using the new and existing example) and on the code from the issue.