daimajia / AndroidSwipeLayout

The Most Powerful Swipe Layout!
MIT License
12.38k stars 2.67k forks source link

SurfaceView misbehaves when mDragDistance < 0 #216

Open phileo opened 9 years ago

phileo commented 9 years ago

SurfaceView jitters and moves the wrong way when mDragDistance < 0. This can be easily reproduced by setting either swipe:rightEdgeSwipeOffset or swipe:leftEdgeSwipeOffset to be much greater than the bottom View's measuredWidth. For example, I set swipe:rightEdgeSwipeOffset=180dp in recyclerview_item.xml. Upon running the recyclerview section of the demo, swiping any recyclerview item will demonstrate the problem.

The mere existance of layout xml attributes swipe:rightEdgeSwipeOffset or swipe:leftEdgeSwipeOffset invites the developer to set random numbers which could break the swiping functionality, that is why I think this should not only be documented, but fixed in code to prevent developer error.

I would like to submit a pull request, my proposed solution is to set mDragDistance=0 (which will effectively disable swiping) whenver the xxxEdgeSwipeOffset exceeds the currentBottomView.getMeasuredWidth(), or is there a better solution to this issue ?