RUM-3868: Don't traverse non-visible ViewGroups for searching user interaction targets #1969
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.
What does this PR do?
This a fix for the following bug: let's imagine we have a container view and a child view in this container, both are visible. If we set
View.GONE
orView.INVISIBLE
for the container view, both views won't be visible, but if we click on the place where child view would be rendered, the tap will be reported.This happens because when we hide container view, child view still have a visibility
View.VISIBLE
despite not participating in rendering (if parent group hasView.INVISIBLE
) or even in the layout process (if parent group hasView.GONE
).This means we need to take into account the visibility of the view groups as well when we are searching for the user interaction target.
Note: child cannot be shown without parent shown, meaning even if we have
View.INVISIBLE
for parent container switching visibility for child view has no effect (at least for built-in view groups as I tested).Review checklist (to be filled by reviewers)