Skip to content

Instantly share code, notes, and snippets.

@Ash-Kay
Last active May 11, 2020 06:48
Show Gist options
  • Save Ash-Kay/73573503712e57ac9c8a6762b0163185 to your computer and use it in GitHub Desktop.
Save Ash-Kay/73573503712e57ac9c8a6762b0163185 to your computer and use it in GitHub Desktop.
override fun onTouchEvent(event: MotionEvent?): Boolean {
when (event?.action) {
MotionEvent.ACTION_UP -> {
val touchPoint = PointF(event.x, event.y)
//Distance between two points
val distance = sqrt(
(centre.x - touchPoint.x).pow(2)
+ (centre.y - touchPoint.y).pow(2)
)
if (dis <= Constants.circleRadius) {
callOnClick()
}
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment