Fix swipe

This commit is contained in:
Alexey Kulish 2016-04-04 15:30:17 +03:00
parent 387e36e552
commit d567ba1c38
2 changed files with 10 additions and 8 deletions

View file

@ -1413,9 +1413,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
@Override
public void onItemSwapping(int position) {
if (swipeDismissListener != null) {
swipeDismissListener.setEnabled(false);
}
}
@SuppressWarnings("unchecked")
@ -1452,10 +1449,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
getMyApplication().getMapMarkersHelper().saveMapMarkers(markers, null);
reloadAdapter();
}
if (swipeDismissListener != null) {
swipeDismissListener.setEnabled(true);
}
}
}, 50);
}

View file

@ -108,6 +108,7 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
private int mDownPosition;
private View mSwipeDownView;
private boolean mSwipePaused;
private boolean mSwipeCanceled;
private PopupWindow mUndoPopup;
private int mValidDelayedMsgId;
@ -635,6 +636,7 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
mSwipeDownView = mSwipeDownChild = null;
mDownPosition = ListView.INVALID_POSITION;
mSwiping = false;
mSwipeCanceled = false;
break;
}
@ -677,17 +679,24 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
mSwipeDownChild = null;
mDownPosition = AbsListView.INVALID_POSITION;
mSwiping = false;
mSwipeCanceled = false;
break;
}
case MotionEvent.ACTION_MOVE: {
if (mVelocityTracker == null || mSwipePaused) {
if (mVelocityTracker == null || mSwipePaused || mSwipeCanceled) {
break;
}
mVelocityTracker.addMovement(ev);
float deltaX = ev.getRawX() - mDownX;
float deltaY = ev.getRawY() - mDownY;
if (!mSwiping && Math.abs(deltaY) > mSlop * 2) {
mSwipeCanceled = true;
break;
}
// Only start swipe in correct direction
if (isSwipeDirectionValid(deltaX)) {
ViewParent parent = mListView.getParent();