title: how to restore recycler view item after swipe
body: <p>I have a recyclerview and I've add swipe to it with itemtouchhelper class and it works fine, there is 2 views in layout that foreground view moves on swipe over bacjground layer, problem is I want to foreground view get the previous location after swipe , like swipe effect that make call in Samsung phones.
  I can make that with calling notifyitemchanged after swipe. but I works one time and if I swipe again on that item, view is not restored
  this is my itemtouchhelper class</p>
  
  <pre><code>public class RecyclerItemTouchHelperlog extends ItemTouchHelper.SimpleCallback {
  private RecyclerItemTouchHelperListener listener;
  
  public RecyclerItemTouchHelperlog(int dragDirs, int swipeDirs, RecyclerItemTouchHelperListener listener) {
      super(dragDirs, swipeDirs);
      this.listener = listener;
  }
  
  @Override
  public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
      return true;
  }
  
  @Override
  public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
      if (viewHolder != null) {
          final View foregroundView = ((recycleAdapterlog.MyViewHolder) viewHolder).logitm;
  
          getDefaultUIUtil().onSelected(foregroundView);
      }
  }
  
  @Override
  public void onChildDrawOver(Canvas c, RecyclerView recyclerView,
                              RecyclerView.ViewHolder viewHolder, float dX, float dY,
                              int actionState, boolean isCurrentlyActive) {
      final View foregroundView = ((recycleAdapterlog.MyViewHolder) viewHolder).logitm;
      getDefaultUIUtil().onDrawOver(c, recyclerView, foregroundView, dX, dY,
              actionState, isCurrentlyActive);
  }
  
  @Override
  public void clearView(@NonNull RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
      final View foregroundView = ((recycleAdapterlog.MyViewHolder) viewHolder).logitm;
      getDefaultUIUtil().clearView(foregroundView);
  }
  
  @Override
  public int getSwipeDirs(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
  
      View hv=((recycleAdapterlog.MyViewHolder) viewHolder).hv;
      if(hv==null)return super.getSwipeDirs(recyclerView, viewHolder);
      else if(hv.getVisibility()==View.VISIBLE)return 0;
      else return super.getSwipeDirs(recyclerView, viewHolder);
  
  
  }
  
  @Override
  public void onChildDraw(Canvas c, @NonNull RecyclerView recyclerView,
                          @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY,
                          int actionState, boolean isCurrentlyActive) {
      final View foregroundView = ((recycleAdapterlog.MyViewHolder) viewHolder).logitm;
      final View swipel = ((recycleAdapterlog.MyViewHolder) viewHolder).swipelogleft;
      final View swiper = ((recycleAdapterlog.MyViewHolder) viewHolder).swipelogright;
      if(dX&lt;0){
          swipel.setVisibility(View.VISIBLE);
          swiper.setVisibility(View.GONE);
      }
      else {
          swipel.setVisibility(View.GONE);
          swiper.setVisibility(View.VISIBLE);
      }
      if(actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
          final Float alpha =1 - Math.abs (dX) / ( viewHolder.itemView.getWidth ());
          foregroundView.setAlpha (alpha);
          foregroundView.setTranslationX (dX);
      }
  
      recentconfrag.swipedlog=true;
  
      getDefaultUIUtil().onDraw(c, recyclerView, foregroundView, dX, dY,
              actionState, isCurrentlyActive);
  }
  
  @Override
  public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
      listener.onSwiped(viewHolder, direction, viewHolder.getAdapterPosition());
  
  
  }
  
  @Override
  public int convertToAbsoluteDirection(int flags, int layoutDirection) {
      return super.convertToAbsoluteDirection(flags, layoutDirection);
  }
  
  public interface RecyclerItemTouchHelperListener {
      void onSwiped(RecyclerView.ViewHolder viewHolder, int direction, int position);
  
  }
  </code></pre>
  
  <p>}</p>