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

Touching outside the balloonWrapper should dismiss the Balloon(PopupWindow) #561

Merged
merged 3 commits into from
Dec 26, 2023

Conversation

nkhar
Copy link
Contributor

@nkhar nkhar commented Dec 21, 2023

🎯 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.

@nkhar nkhar requested a review from skydoves as a code owner December 21, 2023 20:11
Copy link
Owner

@skydoves skydoves left a comment

Choose a reason for hiding this comment

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

Great work, @nkhar! Thanks for your contribution.

balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt Outdated Show resolved Hide resolved
…dded suggested code for right(END) side margin. This should help with the issue: skydoves#486
@skydoves skydoves merged commit 8e09f95 into skydoves:main Dec 26, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants