private void translateHeaderWithNextHeader(RecyclerView recyclerView, int orientation, Rect translation,
    View currentHeader, View viewAfterNextHeader, View nextHeader) {
    mDimensionCalculator.initMargins(mTempRect1, nextHeader);
    mDimensionCalculator.initMargins(mTempRect2, currentHeader);
    if (orientation == LinearLayoutManager.VERTICAL) {
      int topOfStickyHeader = getListTop(recyclerView) + mTempRect2.top + mTempRect2.bottom;
      int shiftFromNextHeader = viewAfterNextHeader.getTop() - nextHeader.getHeight() - mTempRect1.bottom - mTempRect1.top - currentHeader.getHeight() - topOfStickyHeader;
      if (shiftFromNextHeader < topOfStickyHeader) {
        translation.top += shiftFromNextHeader;
      }
    } else {
      int leftOfStickyHeader = getListLeft(recyclerView) + mTempRect2.left + mTempRect2.right;
      int shiftFromNextHeader = viewAfterNextHeader.getLeft() - nextHeader.getWidth() - mTempRect1.right - mTempRect1.left - currentHeader.getWidth() - leftOfStickyHeader;
      if (shiftFromNextHeader < leftOfStickyHeader) {
        translation.left += shiftFromNextHeader;
      }
    }
  }
Determines if an item in the list should have a header that is different than the item in the
list that immediately precedes it. Items with no headers will always return false.

@param position of the list item in questions
@param isReverseLayout TRUE if layout manager has flag isReverseLayout
@return true if this item has a different header than the previous item in the list
library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java