@Override
 public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
   super.onLayoutChildren(recycler, state);
   cacheHeaderPositions();
   positioner.reset(getOrientation(), findFirstVisibleItemPosition());
   positioner.updateHeaderState(
       findFirstVisibleItemPosition(), getVisibleHeaders(), viewRetriever.setRecycler(recycler));
 }
 @Override
 public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
   int scroll = super.scrollVerticallyBy(dy, recycler, state);
   if (Math.abs(scroll) > 0) {
     positioner.updateHeaderState(
         findFirstVisibleItemPosition(), getVisibleHeaders(), viewRetriever.setRecycler(recycler));
   }
   return scroll;
 }