public void pendingRemoval(int position,int swipeDir){
  lastWasUndo=false;
  pendingRemovalItem=list.get(position);
  pendingRemovalPosition=position;
  pendingRemovalSwipeDir=swipeDir;
  if (position != 0 && getItemViewType(position - 1) == TYPE_HEADER && (position == list.size() - 1 || getItemViewType(position + 1) == TYPE_HEADER)) {
    pendingRemovalHeader=list.get(position - 1);
    list.remove(position);
    list.remove(position - 1);
    notifyItemRangeRemoved(position - 1,2);
  }
 else {
    pendingRemovalHeader=null;
    list.remove(position);
    notifyItemRemoved(position);
  }
  if (swipeDir == ItemTouchHelper.LEFT) {
    showSnackbar(swipedLeft(pendingRemovalItem.object));
  }
 else   if (swipeDir == ItemTouchHelper.RIGHT) {
    showSnackbar(swipedRight(pendingRemovalItem.object));
  }
}

public void pendingRemoval ( int position , int swipeDir ) { lastWasUndo = false ; pendingRemovalItem = list . get ( position ) ; pendingRemovalPosition = position ; pendingRemovalSwipeDir = swipeDir ; if ( position != 0 && getItemViewType ( position - 1 ) == TYPE_HEADER && ( position == list . size ( ) - 1 || getItemViewType ( position + 1 ) == TYPE_HEADER ) ) { pendingRemovalHeader = list . get ( position - 1 ) ; list . remove ( position ) ; list . remove ( position - 1 ) ; notifyItemRangeRemoved ( position - 1 , 2 ) ; } else { pendingRemovalHeader = null ; list . remove ( position ) ; notifyItemRemoved ( position ) ; } if ( swipeDir == ItemTouchHelper . LEFT ) { showSnackbar ( swipedLeft ( pendingRemovalItem . object ) ) ; } else if ( swipeDir == ItemTouchHelper . RIGHT ) { showSnackbar ( swipedRight ( pendingRemovalItem . object ) ) ; } }
called when item status should be pending removal . the item gets cached in the adapter and removed from the database .
