Swipe to dismiss modifications
This commit is contained in:
parent
4ecf62ab6a
commit
8bf189a6f6
|
@ -26,5 +26,5 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:support-v4:21.0.3'
|
compile 'com.android.support:support-v4:22.0.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,18 +446,15 @@ public class DragSortController extends SimpleFloatViewManager implements View.O
|
||||||
@Override
|
@Override
|
||||||
public final boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
|
public final boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
|
||||||
float velocityY) {
|
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) {
|
if (mRemoveEnabled && mIsRemoving) {
|
||||||
int w = mDslv.getWidth();
|
int w = mDslv.getWidth();
|
||||||
int minPos = w / 5;
|
if(mPositionX >= w/2) {
|
||||||
if (velocityX > mFlingSpeed) {
|
mDslv.stopDragWithVelocity(true, velocityX);
|
||||||
if (mPositionX > -minPos) {
|
} else if(mPositionX >= w/5 && minSwipeVelocity <= velocityX && velocityX <= maxSwipeVelocity) {
|
||||||
mDslv.stopDragWithVelocity(true, velocityX);
|
mDslv.stopDragWithVelocity(true, velocityX);
|
||||||
}
|
|
||||||
} else if (velocityX < -mFlingSpeed) {
|
|
||||||
if (mPositionX < minPos) {
|
|
||||||
mDslv.stopDragWithVelocity(true, velocityX);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mIsRemoving = false;
|
mIsRemoving = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue