@Override
 public int clampViewPositionVertical(final View child, final int top, final int dy) {
   final int current = mDrawer.getHeaderTop();
   if (!Float.isNaN(mDx) && mDrawer.isValidScroll(mDx, dy)) {
     mScrollingHeaderByHelper = false;
     return current;
   }
   if (dy > 0 && mDrawer.canScrollCallback(-dy) && mDrawer.isTouchingScrollableContent()) {
     if (!mDrawer.isUsingDragHelper()) {
       // Scrolling up while list still has space to scroll, so make header still
       mScrollingHeaderByHelper = false;
       return current;
     } else {
       mDrawer.scrollByCallback(-dy);
       mScrollingHeaderByHelper = false;
       return current;
     }
   }
   final int min = mDrawer.getHeaderTopMinimum(), max = mDrawer.getHeaderTopMaximum();
   if (top < min && mDrawer.isTouchingScrollableContent() && mDrawer.isUsingDragHelper()) {
     mDrawer.scrollByCallback(-dy);
   }
   mScrollingHeaderByHelper = true;
   return MathUtils.clamp(top, min, max);
 }
 @Override
 public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
   if (!mDrawer.isUsingDragHelper() && mDrawer.isValidScroll(distanceY, distanceX)) {
     final int offset = mDrawer.getHeaderTop(), min = mDrawer.getHeaderTopMinimum();
     if (!mDrawer.canScrollCallback(-1)) {
       if (distanceY < 0) {
         if (!mDrawer.isScrollingHeaderByHelper()) {
           mDrawer.offsetHeaderBy(Math.round(-distanceY));
         }
         mDrawer.setScrollingHeaderByGesture(true);
       } else if (distanceY > 0 && offset > min) {
         // Scrolling up when scrolling to list top, so we cancel touch event and scrolling
         // header up
         mDrawer.cancelTouchCallback();
         if (!mDrawer.isScrollingHeaderByHelper()) {
           mDrawer.offsetHeaderBy(Math.round(-distanceY));
         }
       } else if (offset <= min) {
         mDrawer.scrollByCallback(-distanceX);
       }
     }
   }
   return true;
 }