@@ -274,6 +274,7 @@ public boolean onTouch(View v, MotionEvent ev) {
274
274
}
275
275
}
276
276
case MotionEvent .ACTION_CANCEL :
277
+ mIsRemoving = false ;
277
278
mDragging = false ;
278
279
break ;
279
280
}
@@ -407,10 +408,12 @@ public boolean onDown(MotionEvent ev) {
407
408
}
408
409
409
410
mHitPos = startDragPosition (ev );
410
- if (mHitPos != MISS && mDragInitMode == ON_DOWN && mRemoveMode !=FLING_OR_SLIDE_REMOVE ) {
411
- startDrag (mHitPos , (int ) ev .getX () - mItemX , (int ) ev .getY () - mItemY );
411
+ mRemoveHitPos = MISS ;
412
+ boolean startedDrag = false ;
413
+ if (mHitPos != MISS && mDragInitMode == ON_DOWN ) {
414
+ startedDrag = startDrag (mHitPos , (int ) ev .getX () - mItemX , (int ) ev .getY () - mItemY );
412
415
}
413
- if ( mRemoveMode == FLING_OR_SLIDE_REMOVE )
416
+ if ( ! startedDrag && mRemoveMode == FLING_OR_SLIDE_REMOVE )
414
417
{
415
418
mCanDrag = true ;
416
419
mPositionX = 0 ;
@@ -476,7 +479,7 @@ else if (mHitPos != MISS && mDragInitMode == ON_DRAG && !mDragging) {
476
479
@ Override
477
480
public void onLongPress (MotionEvent e ) {
478
481
//Log.d("mobeta", "lift listener long pressed");
479
- if (mHitPos != MISS && mDragInitMode == ON_LONG_PRESS && mRemoveMode != FLING_OR_SLIDE_REMOVE ) {
482
+ if (mHitPos != MISS && mDragInitMode == ON_LONG_PRESS ) {
480
483
mDslv .performHapticFeedback (HapticFeedbackConstants .LONG_PRESS );
481
484
startDrag (mHitPos , mCurrX - mItemX , mCurrY - mItemY );
482
485
}
@@ -510,6 +513,7 @@ public void onShowPress(MotionEvent ev) {
510
513
@ Override
511
514
public final boolean onFling (MotionEvent e1 , MotionEvent e2 , float velocityX , float velocityY ) {
512
515
//Log.d("mobeta", "on fling remove called");
516
+ mIsRemoving = false ;
513
517
if (mRemoveEnabled ) {
514
518
switch (mRemoveMode ) {
515
519
case FLING_OR_SLIDE_REMOVE :
@@ -522,21 +526,13 @@ public final boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, fl
522
526
{
523
527
mDslv .stopDragWithVelocity (true ,velocityX );
524
528
}
525
- else
526
- {
527
- mIsRemoving = false ;
528
- }
529
529
}
530
530
else if (velocityX < -mFlingSpeed )
531
531
{
532
532
if ( mPositionX < minPos )
533
533
{
534
534
mDslv .stopDragWithVelocity (true ,velocityX );
535
535
}
536
- else
537
- {
538
- mIsRemoving = false ;
539
- }
540
536
}
541
537
}
542
538
break ;
0 commit comments