docs: @Override
      public boolean dispatchTouchEvent(MotionEvent ev) {
          int action = MotionEventCompat.getActionMasked(ev);
  
          if (stopScrollWhenTouch) {
              if ((action == MotionEvent.ACTION_DOWN) && isAutoScroll) {
                  isStopByTouch = true;
                  stopAutoScroll();
              } else if (ev.getAction() == MotionEvent.ACTION_UP && isStopByTouch) {
                  startAutoScroll();
              }
          }
  
          if (slideBorderMode == SLIDE_BORDER_MODE_TO_PARENT || slideBorderMode == SLIDE_BORDER_MODE_CYCLE) {
              touchX = ev.getX();
              if (ev.getAction() == MotionEvent.ACTION_DOWN) {
                  downX = touchX;
              }
              int currentItem = getCurrentItem();
              PagerAdapter adapter = getAdapter();
              int pageCount = adapter == null ? 0 : adapter.getCount();
              /**
               * current index is first one and slide to right or current index is last one and slide to left.<br/>
               * if slide border mode is to parent, then requestDisallowInterceptTouchEvent false.<br/>
               * else scroll to last one when current item is first one, scroll to first one when current item is last
               * one.
               */
              if ((currentItem == 0 && downX <= touchX) || (currentItem == pageCount - 1 && downX >= touchX)) {
                  if (slideBorderMode == SLIDE_BORDER_MODE_TO_PARENT) {
                      getParent().requestDisallowInterceptTouchEvent(false);
                  } else {
                      if (pageCount > 1) {
                          setCurrentItem(pageCount - currentItem - 1, isBorderAnimation);
                      }
                      getParent().requestDisallowInterceptTouchEvent(true);
                  }
                  return super.dispatchTouchEvent(ev);
              }
          }
          /**
          * based on https://github.com/youfacepalm comment to fix the issue 
          * "don't consume touch event when scroll up or down #29"
          */
          if (consumeTouch) {
              getParent().requestDisallowInterceptTouchEvent(true);
          } else {
              getParent().requestDisallowInterceptTouchEvent(false);
              if (stopScrollWhenTouch)
                  startAutoScroll();
          }
  
          return super.dispatchTouchEvent(ev);
      }