@Override public void onChildViewDetachedFromWindow(View view){
  final RecyclerView.ViewHolder holder=recyclerView.getChildViewHolder(view);
  if (holder == null || !(holder instanceof SwipeOpenViewHolder)) {
    return;
  }
  final SwipeOpenViewHolder swipeHolder=(SwipeOpenViewHolder)holder;
  if (prevSelected == swipeHolder) {
    prevSelected=null;
  }
  if (selected != null && swipeHolder == selected) {
    select(null,ACTION_STATE_IDLE);
  }
 else {
    callback.clearView(recyclerView,swipeHolder);
    endRecoverAnimation(swipeHolder,false);
  }
}

@ Override public void onChildViewDetachedFromWindow ( View view ) { final RecyclerView . ViewHolder holder = recyclerView . getChildViewHolder ( view ) ; if ( holder == null || ! ( holder instanceof SwipeOpenViewHolder ) ) { return ; } final SwipeOpenViewHolder swipeHolder = ( SwipeOpenViewHolder ) holder ; if ( prevSelected == swipeHolder ) { prevSelected = null ; } if ( selected != null && swipeHolder == selected ) { select ( null , ACTION_STATE_IDLE ) ; } else { callback . clearView ( recyclerView , swipeHolder ) ; endRecoverAnimation ( swipeHolder , false ) ; } }
when a view is detached from the recyclerview it is either because the item has been deleted , or the view is being detached / recycled because it is no longer visible ( e . g . recyclerview has been scrolled )
