title: Not able to clear the partial swipe delete button after swipe back in recycler view android
body: <p>I am trying to create archive like swipe action of gmail in my app.</p>
  
  <p>I am able to draw the image and text while sliding.But the problem is after the slide back the delete button image is not removed.</p>
  
  <p>How to remove the delete button after slide back.I don't know what i'm doing wrong with my code.</p>
  
  <pre><code>class SwipeController extends Callback {
  
      private Paint p = new Paint();
      private Context context;
      public SwipeController(Context context) {
            this.context = context;
      }
      @Override
      public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
          return makeMovementFlags(0, LEFT);
      }
  
  
      @Override
      public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
          return false;
      }
  
      @Override
      public int convertToAbsoluteDirection(int flags, int layoutDirection) {
          Log.d("convertToDirection","convertToAbsoluteDirection Executed");
          return super.convertToAbsoluteDirection(flags, layoutDirection);
      }
      @Override
      public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
          int position = viewHolder.getAdapterPosition();
  
          if (direction == ItemTouchHelper.LEFT){
              //adapter.removeItem(position);remove item from adapter
          }
      }
  
      @Override
      public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
  
          Bitmap icon;
          if(actionState == ItemTouchHelper.ACTION_STATE_SWIPE){
  
              View itemView = viewHolder.itemView;
              float height = (float) itemView.getBottom() - (float) itemView.getTop();
              float width = height / 3;
  
  
              try{
                  if(dX &gt; 0){
                      p.setColor(Color.parseColor("#388E3C"));
                      RectF background = new RectF((float) itemView.getLeft(), (float) itemView.getTop(), dX,(float) itemView.getBottom());
                      c.drawRect(background,p);
                      icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.voicemaildelte);
                      RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
                      c.drawBitmap(icon,null,icon_dest,p);
                  } else {
                      p.setColor(Color.parseColor("#D32F2F"));
                      RectF background = new RectF((float) itemView.getRight() + dX, (float) itemView.getTop(),(float) itemView.getRight(), (float) itemView.getBottom());
                      c.drawRect(background,p);
                      icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.voicemaildelte);
                      RectF icon_dest = new RectF((float) itemView.getRight() - 2*width ,(float) itemView.getTop() + width,(float) itemView.getRight() - width,(float)itemView.getBottom() - width);
                      c.drawBitmap(icon,null,icon_dest,p);
                  }
              }catch(Exception e){
                  e.printStackTrace();
              }
  
          }
          super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
      }
  
  
  }
  </code></pre>
  
  <p>[<img src="https://i.stack.imgur.com/o7wLg.jpg" alt="delete button not removed"><a href="https://i.stack.imgur.com/o7wLg.jpg" rel="nofollow noreferrer">1</a></p>