title: How to selectively decorate RecyclerView items
body: <p>I am creating a subclass of <code>ItemDecoration</code> from this gist: <a href="https://gist.github.com/alexfu/0f464fc3742f134ccd1e">https://gist.github.com/alexfu/0f464fc3742f134ccd1e</a> </p>
  
  <p>How to make it only decorate items with certain condition? For instance, only decorate items with certain positions, type of ViewHolder, etc.</p>
  
  <p>I have modified the above mentioned gist (plus some changes on deprecated Android API) with this code, but <strong>all items</strong> get decorated anyway:</p>
  
  <pre><code>public boolean isDecorated(View view, RecyclerView parent) {
      RecyclerView.ViewHolder holder = parent.getChildViewHolder(view);
      return holder instanceof MenuIconViewHolder || holder instanceof MenuDetailViewHolder;
  }
  
  @Override
  public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
      if (isDecorated(view, parent)) {
          if (mOrientation == VERTICAL_LIST) {
              outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
          } else {
              outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
          }
      } else {
          super.getItemOffsets(outRect, view, parent, state);
      }
  }
  </code></pre>
  
  <p>What's wrong with above code? 
  By the way, can it be considered best practice (in respect of separation of concerns) to place that kind of code in ItemDecoration class?</p>