title: RecyclerView image flicker when using notifyItemChanged and Glide
body: <p>I've seen a few questions that are somewhat similar but have significant differences.</p>
  
  <p><strong>Expected:</strong></p>
  
  <p>I have a vertical <code>RecyclerView</code> of cells with an image and some buttons below it. The image is dynamically sized and loaded using <code>Glide</code>. When the user clicks a button it updates the dataset and performs <code>notifyItemChanged</code> on the item in which the button was clicked. This should then smoothly reload the cell with the same image and any necessary state changes.</p>
  
  <p><strong>Actual</strong></p>
  
  <p>When the user clicks the button the cell and buttons are reloaded as desired but the image flickers significantly as it snaps back into size from 0 height to full height. </p>
  
  <p><strong>What I have so far</strong></p>
  
  <p>From my understanding this is happening because <code>onBindViewHolder</code> is called on that cell which also reloads the image via glide (thus causing the flicker). I added an if check to try and prevent image reload if the same image or holder is being acted upon. Example:</p>
  
  <pre><code>if (holder.tag == null || !holder.tag.equals(item.getId())) {
       // Load image via Glide
  }
  </code></pre>
  
  <p>However this doesn't not trigger properly. It seems that when <code>onBindViewHolder</code> is called, the cell that is being bound for the same position isn't the same cell but some other inactive cell (the cell itself isn't being reused but instead a different inactive one is being brought in to replace it).</p>
  
  <p><strong>Questions</strong></p>
  
  <ul>
  <li>Is replacing the visible cell with an inactive one that is then reconfigured the expected re-use behaviour for <code>notifyItemChanged</code>.</li>
  <li>If so is there anything else I can do to reconfigured only some pieces of the active cell upon user interaction. Ideally I don't want to fully throw out the cell and redraw or I'll end up with the same image flickering.</li>
  </ul>
  
  <p><strong>Temporary workaround</strong> </p>
  
  <p>I reload the RecyclerView items from the db without notifying and then manually changing the button states using the reference to the holder from inside the onClick. I would much rather do this "properly" by simply being able to rebind the whole view</p>
  
  <p>Any suggestions would be appreciated</p>