fixed bug with layout not moving on swipe

This commit is contained in:
unknown 2014-12-23 10:19:01 +05:30
parent 71ef2ad7e8
commit c5d3e6743e
2 changed files with 5 additions and 2 deletions

View File

@ -27,7 +27,7 @@ public class MyActivity extends Activity {
//sample1
sample1 = (SwipeLayout) findViewById(R.id.sample1);
sample1.setShowMode(SwipeLayout.ShowMode.LayDown);
sample1.setShowMode(SwipeLayout.ShowMode.PullOut);
sample1.setDragEdges(SwipeLayout.DragEdge.Left, SwipeLayout.DragEdge.Right);
Toast.makeText(this, sample1.getDragEdge() + " is the drag edge", Toast.LENGTH_LONG).show();
sample1.addRevealListener(R.id.delete, new SwipeLayout.OnRevealListener() {

View File

@ -904,6 +904,7 @@ public class SwipeLayout extends FrameLayout
float angle = Math.abs(distanceY / distanceX);
angle = (float) Math.toDegrees(Math.atan(angle));
if (getOpenStatus() == Status.Close) {
int lastCurrentDirectionIndex = currentDirectionIndex;
if (angle < 45) {
if (mLeftIndex != -1 && distanceX > 0) {
currentDirectionIndex = mLeftIndex;
@ -917,7 +918,9 @@ public class SwipeLayout extends FrameLayout
currentDirectionIndex = mBottomIndex;
}
}
updateBottomViews();
if (lastCurrentDirectionIndex != currentDirectionIndex) {
updateBottomViews();
}
}
boolean doNothing = false;