waldenana / ParallaxBackLayout

无需改动原有activity只需要一个annotation轻松实现任意方向的滑动返回,默认提供微信滑动、跟随滑动、以及单个滑动,并且可以自定义滑动效果
MIT License
405 stars 63 forks source link

Fix multi touch exception #22

Closed rosuH closed 5 years ago

rosuH commented 5 years ago

The event.findPointerIndex() might return -1 if there is no data available for that pointer identifier. So the ev.getX(index) will cause IllegalArgumentException.

Ref: https://developer.android.com/reference/android/view/MotionEvent#findPointerIndex(int)


Exception detail:

java.lang.IllegalArgumentException

pointerIndex out of range
android.view.MotionEvent.nativeGetAxisValue(Native Method)
android.view.MotionEvent.getX(MotionEvent.java:2122)
com.github.anzewei.parallaxbacklayout.ViewDragHelper.void processTouchEvent(android.view.MotionEvent)(TbsSdkJava:1229)
com.github.anzewei.parallaxbacklayout.widget.ParallaxBackLayout.boolean onTouchEvent(android.view.MotionEvent)(TbsSdkJava:173)
android.view.View.dispatchTouchEvent(View.java:10054)
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2657)
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2322)
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2663)
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2336)