diff options
author | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-03-14 15:40:10 +0100 |
---|---|---|
committer | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-03-14 15:40:10 +0100 |
commit | 8bf189a6f6a5db40c7e2242b0613399efdce8c8c (patch) | |
tree | e24d156defebcd8d1a049632057a9547219424c7 /library | |
parent | 4ecf62ab6a2296e5271807fe925ff401ff7e629a (diff) | |
download | AntennaPod-8bf189a6f6a5db40c7e2242b0613399efdce8c8c.zip |
Swipe to dismiss modifications
Diffstat (limited to 'library')
-rw-r--r-- | library/drag-sort-listview/build.gradle | 2 | ||||
-rw-r--r-- | library/drag-sort-listview/src/main/java/com/mobeta/android/dslv/DragSortController.java | 17 |
2 files changed, 8 insertions, 11 deletions
diff --git a/library/drag-sort-listview/build.gradle b/library/drag-sort-listview/build.gradle index fbdf12cc2..519bb2430 100644 --- a/library/drag-sort-listview/build.gradle +++ b/library/drag-sort-listview/build.gradle @@ -26,5 +26,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:support-v4:21.0.3' + compile 'com.android.support:support-v4:22.0.0' } diff --git a/library/drag-sort-listview/src/main/java/com/mobeta/android/dslv/DragSortController.java b/library/drag-sort-listview/src/main/java/com/mobeta/android/dslv/DragSortController.java index 41d477e92..6acf6b42e 100644 --- a/library/drag-sort-listview/src/main/java/com/mobeta/android/dslv/DragSortController.java +++ b/library/drag-sort-listview/src/main/java/com/mobeta/android/dslv/DragSortController.java @@ -446,18 +446,15 @@ public class DragSortController extends SimpleFloatViewManager implements View.O @Override public final boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - // Log.d("mobeta", "on fling remove called"); + ViewConfiguration vc = ViewConfiguration.get(mDslv.getContext()); + int minSwipeVelocity = vc.getScaledMinimumFlingVelocity(); + int maxSwipeVelocity = vc.getScaledMaximumFlingVelocity(); if (mRemoveEnabled && mIsRemoving) { int w = mDslv.getWidth(); - int minPos = w / 5; - if (velocityX > mFlingSpeed) { - if (mPositionX > -minPos) { - mDslv.stopDragWithVelocity(true, velocityX); - } - } else if (velocityX < -mFlingSpeed) { - if (mPositionX < minPos) { - mDslv.stopDragWithVelocity(true, velocityX); - } + if(mPositionX >= w/2) { + mDslv.stopDragWithVelocity(true, velocityX); + } else if(mPositionX >= w/5 && minSwipeVelocity <= velocityX && velocityX <= maxSwipeVelocity) { + mDslv.stopDragWithVelocity(true, velocityX); } mIsRemoving = false; } |