class OffRouteDetector extends OffRoute {

  @Override
  public boolean isUserOffRoute(Location location, RouteProgress routeProgress, MapboxNavigationOptions options) {

    if (checkDistanceRemaining(routeProgress)) {
      return true;
    }

    if (!validOffRoute(location, options)) {
      return false;
    }
    Point currentPoint = Point.fromLngLat(location.getLongitude(), location.getLatitude());
    boolean isOffRoute = checkOffRouteRadius(location, routeProgress, options, currentPoint);

    if (!isOffRoute) {
      return isMovingAwayFromManeuver(location, routeProgress, distancesAwayFromManeuver, currentPoint);
    }

    LegStep upComingStep = routeProgress.currentLegProgress().upComingStep();
    if (closeToUpcomingStep(options, callback, currentPoint, upComingStep)) {
      return false;
    }

    // All checks have run, return true
    updateLastReroutePoint(location);
    return true;
  }

}