code: public boolean checkTouchSlop(int directions, int pointerId) {
          if (!isPointerDown(pointerId)) {
              return false;
          }
  
          final boolean checkHorizontal = (directions & DIRECTION_HORIZONTAL) == DIRECTION_HORIZONTAL;
          final boolean checkVertical = (directions & DIRECTION_VERTICAL) == DIRECTION_VERTICAL;
  
          final float dx = mLastMotionX[pointerId] - mInitialMotionX[pointerId];
          final float dy = mLastMotionY[pointerId] - mInitialMotionY[pointerId];
  
          if (checkHorizontal && checkVertical) {
              return dx * dx + dy * dy > mTouchSlop * mTouchSlop;
          } else if (checkHorizontal) {
              return Math.abs(dx) > mTouchSlop;
          } else if (checkVertical) {
              return Math.abs(dy) > mTouchSlop;
          }
          return false;
      }
docs: Check if the specified pointer tracked in the current gesture has crossed
  the required slop threshold.
  
  <p>This depends on internal state populated by
  {@link #shouldInterceptTouchEvent(android.view.MotionEvent)} or
  {@link #processTouchEvent(android.view.MotionEvent)}. You should only rely on
  the results of this method after all currently available touch data
  has been provided to one of these two methods.</p>
  
  @param directions Combination of direction flags, see {@link #DIRECTION_HORIZONTAL},
  {@link #DIRECTION_VERTICAL}, {@link #DIRECTION_ALL}
  @param pointerId ID of the pointer to slop check as specified by MotionEvent
  @return true if the slop threshold has been crossed, false otherwise