code: public static MotionDirection getHorizontalMotionDirection(float delta, float threshold) {
          if (threshold < 0) {
              throw new IllegalArgumentException("threshold should be positive or zero.");
          }
          return delta < -threshold ? MotionDirection.LEFT : delta > threshold ? MotionDirection.RIGHT : MotionDirection.FIX;
      }
docs: Calculate the horizontal move motion direction.
  @param delta moved delta.
  @param threshold threshold to detect the motion.
  @return the motion direction for the horizontal axis.