boolean onItemMove(final int fromPos,final int toPos){
  if (mSwappedItem == null) {
    mStartDragPos=fromPos;
    mSwappedItem=mData.get(fromPos);
  }
  mStopDragPos=toPos;
  final int jumpSize=Math.abs(toPos - fromPos);
  if (jumpSize > 1) {
    final int sign=Integer.signum(toPos - fromPos);
    int startPos=fromPos;
    for (int i=0; i < jumpSize; i++) {
      final int endPos=startPos + sign;
      Collections.swap(mData,startPos,endPos);
      startPos+=sign;
    }
  }
 else {
    Collections.swap(mData,fromPos,toPos);
  }
  notifyItemMoved(fromPos,toPos);
  return true;
}

boolean onItemMove ( final int fromPos , final int toPos ) { if ( mSwappedItem == null ) { mStartDragPos = fromPos ; mSwappedItem = mData . get ( fromPos ) ; } mStopDragPos = toPos ; final int jumpSize = Math . abs ( toPos - fromPos ) ; if ( jumpSize > 1 ) { final int sign = Integer . signum ( toPos - fromPos ) ; int startPos = fromPos ; for ( int i = 0 ; i < jumpSize ; i ++ ) { final int endPos = startPos + sign ; Collections . swap ( mData , startPos , endPos ) ; startPos += sign ; } } else { Collections . swap ( mData , fromPos , toPos ) ; } notifyItemMoved ( fromPos , toPos ) ; return true ; }
moves item from one position to another .
