Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Commit

Permalink
Allow swiping in touch intercepting parents. Fix #38
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes committed Mar 7, 2014
1 parent ea490b6 commit 7d9df39
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.AbsListView;
import android.widget.Button;
import android.widget.ListView;
Expand Down Expand Up @@ -747,6 +748,12 @@ && velocityY < velocityX && mSwiping && isSwipeDirectionValid(mVelocityTracker.g
float deltaX = ev.getRawX() - mDownX;
// Only start swipe in correct direction
if(isSwipeDirectionValid(deltaX)) {
ViewParent parent = getParent();
if(parent != null) {
// If we swipe don't allow parent to intercept touch (e.g. like NavigationDrawer does)
// otherwise swipe would not be working.
parent.requestDisallowInterceptTouchEvent(true);
}
if (Math.abs(deltaX) > mSlop) {
mSwiping = true;
requestDisallowInterceptTouchEvent(true);
Expand Down

0 comments on commit 7d9df39

Please sign in to comment.