Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Attempt to solve issue with parent intercepting touch events meant to vi... #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion viewflow/src/org/taptwo/android/widget/ViewFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ public boolean onTouchEvent(MotionEvent ev) {
}

if (mTouchState == TOUCH_STATE_SCROLLING) {
if(getParent() != null)
getParent().requestDisallowInterceptTouchEvent(true);
// Scroll to follow the motion event
final int deltaX = (int) (mLastMotionX - x);
mLastMotionX = x;
Expand Down Expand Up @@ -366,11 +368,14 @@ && mCurrentScreen < getChildCount() - 1) {
}

mTouchState = TOUCH_STATE_REST;

if(getParent() != null)
getParent().requestDisallowInterceptTouchEvent(false);
break;
case MotionEvent.ACTION_CANCEL:
snapToDestination();
mTouchState = TOUCH_STATE_REST;
if(getParent() != null)
getParent().requestDisallowInterceptTouchEvent(false);
}
return true;
}
Expand Down