Skip to content

Instantly share code, notes, and snippets.

@JonCooperWorks

JonCooperWorks/ontouch.kt Secret

Last active Apr 10, 2019
Embed
What would you like to do?
override fun onTouch(v: View, event: MotionEvent): Boolean {
val x = event.x
val y = event.y
Log.d(TAG, "Touch coordinates: ($x, $y)")
// Android returns (0, 0) for all touches outside of our overlay.
// Since all overlays share this OnTouchListener, this condition will only be true when the
// user has clicked on the hole left for the clickjacked UI control.
if (x == 0.0F && y == 0.0F) {
onUserClickedOutsideOverlay()
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.