1

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.

Community
  • 1
  • 1
Presen
  • 1,809
  • 4
  • 31
  • 46
  • why do you need onScroll? – pskink Apr 17 '14 at 08:17
  • @pskink even if I use `ACTION_MOVE` in `onTouchEvent(...)` instead of `onScroll(...)` 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. – Presen Apr 17 '14 at 08:29
  • see my answer here http://stackoverflow.com/questions/21633545/android-imageview-scaling-and-translating-issue how i combined together move/scale/rotate gestures – pskink Apr 17 '14 at 08:32
  • @pskink can you please highlight the main idea in your solution that solves the arrangement issue between `onMove(...)` and `onScale(...)` . Thanks! – Presen Apr 17 '14 at 08:55
  • the main idea is to transform the Matrix in the gestures' callbacks and using that Matrix for Bitmap drawing – pskink Apr 17 '14 at 09:01
  • @pskink and it's wise to use a Matrix although I'm not handling any image changes? – Presen Apr 17 '14 at 09:26
  • ok so what do you need scale/move for? – pskink Apr 17 '14 at 09:38
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/50861/discussion-between-user1869297-and-pskink) – Presen Apr 17 '14 at 09:51

0 Answers0