title: How to find if the RecyclerView is being Scrolled up or down
body: <p>I have  a <code>RecyclerView</code> with <code>GridLayoutManager</code> , i want to find inside the method <code>getItemOffsets</code> of the Class <code>RecyclerView.ItemDecoration</code> if the user is scrolling up or down . Below is my code inside the class <code>GridDividerDecoration</code> where i draw borders between the items. </p>
  
  <pre><code>public class GridDividerDecorations extends RecyclerView.ItemDecoration {
  private int mInsets;
  List&lt;Integer&gt; itemsHeaderPos= new ArrayList&lt;&gt;();
  List&lt;Integer&gt; itemsPos= new ArrayList&lt;&gt;();
  List&lt;GadgetItem&gt; mList = new ArrayList&lt;&gt;();
  int lastItem;
  int itemPosition, itemposition2 = 0;
  
  public GridDividerDecorations(Context context,List&lt;GadgetItem&gt; mList ) {
      this.mList = mList;
      mInsets = 6;
  }
  
  
  @Override
  public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
      itemPosition = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewAdapterPosition();
  
      if ((parent.getAdapter().getItemViewType(itemPosition) == 0))
          itemsHeaderPos.add(itemPosition);
      if((parent.getAdapter().getItemViewType(itemPosition) != 0))
          itemsPos.add(itemPosition);
  
      outRect.top = mInsets;
  
      GridLayoutManager layoutManager = (GridLayoutManager)parent.getLayoutManager();
      if(itemPosition == layoutManager.findLastVisibleItemPosition())
          outRect.right = mInsets;
  
          if (itemPosition % 2 == 0 &amp;&amp; itemsHeaderPos.get(itemsHeaderPos.size() - 1) % 2 == 0) {
              if (parent.getAdapter().getItemViewType(itemPosition) != 0)
                  outRect.left = mInsets;
          } else if (itemPosition % 2 == 0 &amp;&amp; itemsHeaderPos.get(itemsHeaderPos.size() - 1) % 2 != 0) {
              if (parent.getAdapter().getItemViewType(itemPosition) != 0) {
                  outRect.right = mInsets;
              }
          }
  
  }
  }
  </code></pre>
  
  <p>The thing is that when I scroll up the dividers are painted upside down, so finding if the user scroll ups i can revert my implementation. Thank you!</p>