I thought it's easy. Like always
//somewhere inside constructor
overlay.addOnTouchListener(this)
//...
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
event?:return false
if (event.actionMasked == MotionEvent.ACTION_DOWN || event.actionMasked == MotionEvent.ACTION_POINTER_DOWN) {
//start drag
moving=true
} else if (event.actionMasked == MotionEvent.ACTION_MOVE) {
if (!moving) return true
//do drag
} else if (event.actionMasked == MotionEvent.ACTION_UP) {
//stop drag
println("touch:up(${event.pointerCount})")
}
return true
}
I was expecting MotionEvent.ACTION_UP will fire up on release of each finger.But looks like it only fires once for the last finger.
Is there way catch moment when user releases one finger but keep's moving another one?
The initial statement is incorrect. Actualy android notifies all touch ups with events MotionEvent.ACTION_UP/MotionEvent.ACTION_POINTER_UP