code: public boolean hasStickyHeader(View itemView, int orientation, int position) {
      int offset, margin;
      mDimensionCalculator.initMargins(mTempRect1, itemView);
      if (orientation == LinearLayout.VERTICAL) {
        offset = itemView.getTop();
        margin = mTempRect1.top;
      } else {
        offset = itemView.getLeft();
        margin = mTempRect1.left;
      }
  
      return offset <= margin && mAdapter.getHeaderId(position) >= 0;
    }
docs: Determines if a view should have a sticky header.
  The view has a sticky header if:
  1. It is the first element in the recycler view
  2. It has a valid ID associated to its position
  
  @param itemView given by the RecyclerView
  @param orientation of the Recyclerview
  @param position of the list item in question
  @return True if the view should have a sticky header