Skip to content

Commit 6318e23

Browse files
authored
Merge pull request #22 from rosuH/master
Fix multi touch exception
2 parents 0977d09 + 942202f commit 6318e23

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

parallaxbacklayout/src/main/java/com/github/anzewei/parallaxbacklayout/ViewDragHelper.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,9 @@ public void processTouchEvent(MotionEvent ev) {
12261226
case MotionEvent.ACTION_MOVE: {
12271227
if (mDragState == STATE_DRAGGING) {
12281228
final int index = ev.findPointerIndex(mActivePointerId);
1229+
if (ev.getPointerCount() <= index || index < 0){
1230+
return;
1231+
}
12291232
final float x = ev.getX( index);
12301233
final float y = ev.getY(index);
12311234
final int idx = (int) (x - mLastMotionX[mActivePointerId]);
@@ -1580,4 +1583,4 @@ private int getEdgeTouched(int x, int y) {
15801583

15811584
return result;
15821585
}
1583-
}
1586+
}

parallaxbacklayout/src/main/java/com/github/anzewei/parallaxbacklayout/widget/ParallaxBackLayout.java

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
161161
// FIXME: handle exception
162162
// issues #9
163163
return false;
164+
} catch (IllegalArgumentException iae){
165+
return false;
164166
}
165167
}
166168

0 commit comments

Comments
 (0)