com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute Java Examples

The following examples show how to use com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MockNavigationActivity.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
@Override
public void onMapReady(MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;

  locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap);
  locationLayerPlugin.setRenderMode(RenderMode.GPS);
  locationLayerPlugin.setLocationLayerEnabled(false);
  navigationMapRoute = new NavigationMapRoute(navigation, mapView, mapboxMap);

  mapboxMap.addOnMapClickListener(this);
  Snackbar.make(findViewById(R.id.container), "Tap map to place waypoint", BaseTransientBottomBar.LENGTH_LONG).show();

  locationEngine = new ReplayRouteLocationEngine();

  newOrigin();
}
 
Example #2
Source File: NavigationMapboxMapTest.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Test
public void drawRoutes_mapRoutesAreAdded() {
  NavigationMapRoute mapRoute = mock(NavigationMapRoute.class);
  NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapRoute);
  List<DirectionsRoute> routes = new ArrayList<>();

  theNavigationMap.drawRoutes(routes);

  verify(mapRoute).addRoutes(eq(routes));
}
 
Example #3
Source File: NavigationMapboxMapTest.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Test
public void setOnRouteSelectionChangeListener_listenerIsSet() {
  NavigationMapRoute mapRoute = mock(NavigationMapRoute.class);
  NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapRoute);
  OnRouteSelectionChangeListener listener = mock(OnRouteSelectionChangeListener.class);

  theNavigationMap.setOnRouteSelectionChangeListener(listener);

  verify(mapRoute).setOnRouteSelectionChangeListener(eq(listener));
}
 
Example #4
Source File: NavigationMapboxMapTest.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Test
public void showAlternativeRoutes_correctVisibilityIsSet() {
  NavigationMapRoute mapRoute = mock(NavigationMapRoute.class);
  NavigationMapboxMap theNavigationMap = new NavigationMapboxMap(mapRoute);
  boolean notVisible = false;

  theNavigationMap.showAlternativeRoutes(notVisible);

  verify(mapRoute).showAlternativeRoutes(notVisible);
}
 
Example #5
Source File: NavigationMapRouteActivity.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Override
public void onMapReady(MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;
  navigationMapRoute = new NavigationMapRoute(null, mapView, mapboxMap,
    "admin-3-4-boundaries-bg");
  Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create())
    .create();
  DirectionsResponse response = gson.fromJson(loadJsonFromAsset(DIRECTIONS_RESPONSE),
    DirectionsResponse.class);
  navigationMapRoute.addRoute(response.routes().get(0));
  mapboxMap.addOnMapLongClickListener(this);
  navigationMapRoute.setOnRouteSelectionChangeListener(this);
}
 
Example #6
Source File: NavigationMapboxMap.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
NavigationMapboxMap(NavigationMapRoute mapRoute) {
  this.mapRoute = mapRoute;
}
 
Example #7
Source File: NavigationMapboxMap.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
private void initializeRoute(MapView mapView, MapboxMap map) {
  Context context = mapView.getContext();
  int routeStyleRes = ThemeSwitcher.retrieveNavigationViewStyle(context, R.attr.navigationViewRouteStyle);
  mapRoute = new NavigationMapRoute(null, mapView, map, routeStyleRes);
}
 
Example #8
Source File: DualNavigationMapActivity.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
private void initMapRoute() {
  mapRoute = new NavigationMapRoute(mapView, mapboxMap);
  mapRoute.setOnRouteSelectionChangeListener(this);
}
 
Example #9
Source File: NavigationLauncherActivity.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
private void initMapRoute() {
  mapRoute = new NavigationMapRoute(mapView, mapboxMap);
  mapRoute.setOnRouteSelectionChangeListener(this);
}
 
Example #10
Source File: NavigationMapRouteActivity.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
public NavigationMapRoute getNavigationMapRoute() {
  return navigationMapRoute;
}
 
Example #11
Source File: NavigationLauncherActivity.java    From graphhopper-navigation-example with Apache License 2.0 4 votes vote down vote up
private void initMapRoute() {
    mapRoute = new NavigationMapRoute(mapView, mapboxMap);
    mapRoute.setOnRouteSelectionChangeListener(this);
}