I have read some different responses for this same question, so I dont know which one is right, then I decided to ask it again. Please try to not refer any other link in this answer. If you want to do so, I will be expecting a bit of extra explanation.
My question is:
I have an ImageView inside a ViewPager, my ImageView has some gestures detection(zoom and pan) and I am using the default ViewPager, which has swipe detection by default.
How does the chain of onTouch events work? The lowest view in my hierarchy will always get onTouch and if the method returns false will parent handle it? Perhaps the opposite?
I am asking that, because I have a ImageView which has gestures to left and right, and when I get in the edge of the image, I have to dispatch an event to the parent (a ViewPager) to handle the pagination event. any further tip in how to do it, it will be really appreciated.
So, I have managed that multiple touches in children views of ViewPager in a better way then onInterceptTouchEvent, I am saying that, because in my case, in order to know if I had to scroll the children views instead of the Pager, I needed the distance between the start and end points, and I didnt want to hold that variables and calculate the delta afterwards.
Anyways, After going into the source code for ViewPager, I found out that there is a really good method that I should be implementing for this reason.
Here is my implementation:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/support/v4/view/ViewPager.java#ViewPager.canScroll%28android.view.View%2Cboolean%2Cint%2Cint%2Cint%29