@Override
  public void endDrag(float x, float y) {
    if (!isZooming()) {
      if (isSwipeEnabled) {
        float distance;
        if (swipeVertical) distance = y - startDragY;
        else distance = x - startDragX;

        long time = System.currentTimeMillis() - startDragTime;
        int diff = distance > 0 ? -1 : +1;

        if (isQuickMove(distance, time) || isPageChange(distance)) {
          pdfView.showPage(pdfView.getCurrentPage() + diff);
        } else {
          pdfView.showPage(pdfView.getCurrentPage());
        }
      }
    } else {
      pdfView.loadPages();
    }
  }
 @Override
 public void startDrag(float x, float y) {
   startDragTime = System.currentTimeMillis();
   startDragX = x;
   startDragY = y;
 }