I want to catch two gestures, the first one is a scroll, fire a movement of a view
.
The second gesture is a pinch-in, fire startActivityForResult
on different Activity
.
My problem that onScroll(...)
and onScale(...)
are called alternatively, and I didn't found a consistency, particularly the gesture can begin with onScroll
or onScale
.
example of a gesture:
onDown
onScroll
onScaleBegin
onScale
onScroll
onScale
This post assume to manage the problem, but there the pinch lead to continuous changing of the image, using a matrix
, while I'm looking for a single response (jump to different activity).
In this post they suggested a practice to prevent onScroll(...)
to be called after onScale(...)
was called, but this doesn't solves the case that onScroll(...)
called before onScale(...)
.
I thought to create a small delay before firing the onScroll response, enable the onScale(...)
a chance to be called. But this is bad idea of course.
EDIT: another option is to use ACTION_MOVE
in onTouchEvent(...)
instead of override
onScroll(...)
.
The problem is that now how would I know if the firsts ACTION_MOVE
should be interpret as a scroll gesture, hence move the view up\down,
or as pointers movement before onScroll(...)
will be called, and then I moved the view without any reason.