Touching outside the balloonWrapper should dismiss the Balloon(PopupWindow) #561
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.
🎯 Goal
Touching outside the balloonWrapper should dismiss the PopupWindow. This should help with the issue: 486. This is not the finished product but a work in progress.
🛠 Implementation details
if (event.action == MotionEvent.ACTION_UP) {
if(binding.balloonWrapper.getViewPointOnScreen().x > event.rawX) {
if (builder.dismissWhenTouchOutside) {
this@Balloon.dismiss()
}
onBalloonOutsideTouchListener?.onBalloonOutsideTouch(view, event)
return true
}
}
If the user touches to the left of the balloonWrapper Balloon will be dismissed. This solves the issue for the left margin, but other margins should also be considered. The code is not fully polished therefore the way the coordinates are accessed might change as well as the actions that cause Balloon to be dismissed.
Further Guidance
I am not sure if this should be a draft pull request?
This will need further review and guidance to decide how to solve this issue or maybe this is the expected behaviour and should not be considered an issue.