I'm working on an SDK in which I set an OnTouchListener
to 2 different views from two different classes that each one of them needs to handle the same touch events for its purposes.
Until now I only needed the ACTION_DOWN
event in one of them so the method was written as follows:
@Override
public boolean onTouch(View v, MotionEvent event) {
ABLogger.d("onTouch Walkthrough handler");
if (event.getAction() != MotionEvent.ACTION_DOWN) {
return false;
}
return onAction(v, event);
}
And it was working well as I was receiving the ACTION_DOWN
event passing false
as a return value, and the following events would be propagated to the next view and its listener in line.
Now I need to test in this method that scroll wasn't committed, in order to do that I need to receive here the ACTION_UP
event as well. But I won't receive it unless I pass true
in the return of this method. But if I do that the next listener in line does not receive the events anymore.
The question is: How can I receive all the events in both listeners, or at least receive the event in one of them and force it to pass the event to the second one as well?