android-target-tooltip
android-target-tooltip copied to clipboard
Close Policy Documentation
A documentation on how close policy works is required. Where may I find it?
Especially, I want to know what does the consume boolean means and does?
@stripathi669 I now this is reaaaally old, but well.. for future readers.
I was diving on the code and the fast documentation is on this code:
override fun onTouchEvent(event: MotionEvent): Boolean {
if (!isShowing || !isVisible || !mActivated) return false
Timber.i("onTouchEvent: $event")
Timber.d("event position: ${event.x}, ${event.y}")
val r1 = Rect()
mTextView.getGlobalVisibleRect(r1)
val containsTouch = r1.contains(event.x.toInt(), event.y.toInt())
if (mClosePolicy.anywhere()) {
hide()
} else if (mClosePolicy.inside() && containsTouch) {
hide()
} else if (mClosePolicy.outside() && !containsTouch) {
hide()
}
return mClosePolicy.consume()
}
INSIDE => hides when clicked INSIDE the tooltip
OUTSIDE => hides when clicked OUTSIDE the tooltip
CONSUME=> Consume the click on the view, so no click is propagated to the rest of the view.
This has some weird behaviour, because if you set to
False -> when clicking will pass the touches too on the below views
True -> when you try to touch or do a gesture this will not act to your touches
So ANYWARE_CONSUME => hide on any touch and no elements below will be touched
INSIDE_NO_CONSUME => hide on click inside BUT the elements below will be clicked too (TOO WEIRD!)
and so on.
Hope this helps
@sephiroth74 If it's ok, I could add this to the wiki section
Added to wiki
@whoyawn Could you please paste the link to the doc, because I cannot find it on the wiki space https://github.com/sephiroth74/android-target-tooltip/wiki
Thanks!
https://github.com/sephiroth74/android-target-tooltip/wiki/Close-Policy-Documentation
Hello @whoyawn. Ok, Thanks! But don't you think we should update too the main wiki page?, but the users will not found this wiki documentation you created.
I have add the link on main wiki https://github.com/sephiroth74/android-target-tooltip/wiki
I have edited the policy documentation too to explianed better, this could be even better if the explanation will be on a JavaDoc on code. Sorry but I don't have the time right now to make a PR about it.