Fix swipe
This commit is contained in:
parent
387e36e552
commit
d567ba1c38
2 changed files with 10 additions and 8 deletions
|
@ -1413,9 +1413,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemSwapping(int position) {
|
public void onItemSwapping(int position) {
|
||||||
if (swipeDismissListener != null) {
|
|
||||||
swipeDismissListener.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -1452,10 +1449,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
getMyApplication().getMapMarkersHelper().saveMapMarkers(markers, null);
|
getMyApplication().getMapMarkersHelper().saveMapMarkers(markers, null);
|
||||||
reloadAdapter();
|
reloadAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swipeDismissListener != null) {
|
|
||||||
swipeDismissListener.setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,7 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
|
||||||
private int mDownPosition;
|
private int mDownPosition;
|
||||||
private View mSwipeDownView;
|
private View mSwipeDownView;
|
||||||
private boolean mSwipePaused;
|
private boolean mSwipePaused;
|
||||||
|
private boolean mSwipeCanceled;
|
||||||
|
|
||||||
private PopupWindow mUndoPopup;
|
private PopupWindow mUndoPopup;
|
||||||
private int mValidDelayedMsgId;
|
private int mValidDelayedMsgId;
|
||||||
|
@ -635,6 +636,7 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
|
||||||
mSwipeDownView = mSwipeDownChild = null;
|
mSwipeDownView = mSwipeDownChild = null;
|
||||||
mDownPosition = ListView.INVALID_POSITION;
|
mDownPosition = ListView.INVALID_POSITION;
|
||||||
mSwiping = false;
|
mSwiping = false;
|
||||||
|
mSwipeCanceled = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,17 +679,24 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
|
||||||
mSwipeDownChild = null;
|
mSwipeDownChild = null;
|
||||||
mDownPosition = AbsListView.INVALID_POSITION;
|
mDownPosition = AbsListView.INVALID_POSITION;
|
||||||
mSwiping = false;
|
mSwiping = false;
|
||||||
|
mSwipeCanceled = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MotionEvent.ACTION_MOVE: {
|
case MotionEvent.ACTION_MOVE: {
|
||||||
if (mVelocityTracker == null || mSwipePaused) {
|
if (mVelocityTracker == null || mSwipePaused || mSwipeCanceled) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mVelocityTracker.addMovement(ev);
|
mVelocityTracker.addMovement(ev);
|
||||||
float deltaX = ev.getRawX() - mDownX;
|
float deltaX = ev.getRawX() - mDownX;
|
||||||
float deltaY = ev.getRawY() - mDownY;
|
float deltaY = ev.getRawY() - mDownY;
|
||||||
|
|
||||||
|
if (!mSwiping && Math.abs(deltaY) > mSlop * 2) {
|
||||||
|
mSwipeCanceled = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Only start swipe in correct direction
|
// Only start swipe in correct direction
|
||||||
if (isSwipeDirectionValid(deltaX)) {
|
if (isSwipeDirectionValid(deltaX)) {
|
||||||
ViewParent parent = mListView.getParent();
|
ViewParent parent = mListView.getParent();
|
||||||
|
|
Loading…
Reference in a new issue