Skip to content

Commit 3671a5c

Browse files
committed
modify view capturing process to avoid wrong operation
1 parent faeb287 commit 3671a5c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

library/src/main/java/me/imid/swipebacklayout/lib/SwipeBackLayout.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,16 @@ public boolean tryCaptureView(View view, int i) {
496496
}
497497
mIsScrollOverValid = true;
498498
}
499-
return ret;
499+
boolean directionCheck = false;
500+
if (mEdgeFlag == EDGE_LEFT || mEdgeFlag == EDGE_RIGHT) {
501+
directionCheck = !mDragHelper.checkTouchSlop(ViewDragHelper.DIRECTION_VERTICAL, i);
502+
} else if (mEdgeFlag == EDGE_BOTTOM) {
503+
directionCheck = !mDragHelper
504+
.checkTouchSlop(ViewDragHelper.DIRECTION_HORIZONTAL, i);
505+
} else if (mEdgeFlag == EDGE_ALL) {
506+
directionCheck = true;
507+
}
508+
return ret & directionCheck;
500509
}
501510

502511
@Override

0 commit comments

Comments
 (0)