@Override
  public int getOrientation(RecyclerView recyclerView) {
    RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
    throwIfNotLinearLayoutManager(layoutManager);
    return ((LinearLayoutManager) layoutManager).getOrientation();
  }
OrientationProvider for ReyclerViews who use a LinearLayoutManager
library/src/main/java/com/timehop/stickyheadersrecyclerview/util/LinearLayoutOrientationProvider.java