@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;
 }
 @Override
 public boolean onDown(MotionEvent e) {
   mDrawer.setScrollingHeaderByGesture(false);
   mDrawer.setScrollingContentCallback(false);
   return true;
 }