use of com.mapbox.services.android.navigation.v5.offroute.OffRoute in project mapbox-navigation-android by mapbox.
the class NavigationHelper method isUserOffRoute.
static boolean isUserOffRoute(NewLocationModel newLocationModel, RouteProgress routeProgress, OffRouteCallback callback) {
MapboxNavigationOptions options = newLocationModel.mapboxNavigation().options();
if (!options.enableOffRouteDetection()) {
return false;
}
Location location = newLocationModel.location();
OffRoute offRoute = newLocationModel.mapboxNavigation().getOffRouteEngine();
setOffRouteDetectorCallback(offRoute, callback);
return offRoute.isUserOffRoute(location, routeProgress, options);
}
use of com.mapbox.services.android.navigation.v5.offroute.OffRoute in project mapbox-navigation-android by mapbox.
the class MapboxNavigationTest method setOffRouteEngine_doesReplaceDefaultEngine.
@Test
public void setOffRouteEngine_doesReplaceDefaultEngine() throws Exception {
OffRoute offRoute = navigation.getOffRouteEngine();
assertTrue(offRoute instanceof OffRouteDetector);
offRoute = mock(OffRoute.class);
navigation.setOffRouteEngine(offRoute);
assertTrue(!(navigation.getOffRouteEngine() instanceof OffRouteDetector));
assertTrue(navigation.getOffRouteEngine() instanceof OffRoute);
}
Aggregations