use of com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation in project mapbox-navigation-android by mapbox.
the class RerouteActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reroute);
ButterKnife.bind(this);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
// Initialize MapboxNavigation and add listeners
MapboxNavigationOptions options = MapboxNavigationOptions.builder().isDebugLoggingEnabled(true).build();
navigation = new MapboxNavigation(getApplicationContext(), Mapbox.getAccessToken(), options);
navigation.addNavigationEventListener(this);
navigation.addMilestoneEventListener(this);
}
use of com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation in project mapbox-navigation-android by mapbox.
the class NavigationCameraTest method onStartWithNullRoute_progressListenerIsAdded.
@Test
public void onStartWithNullRoute_progressListenerIsAdded() throws Exception {
MapboxNavigation navigation = mock(MapboxNavigation.class);
ProgressChangeListener listener = mock(ProgressChangeListener.class);
NavigationCamera camera = buildCamera(navigation, listener);
camera.start(null);
verify(navigation, times(1)).addProgressChangeListener(listener);
}
use of com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation in project mapbox-navigation-android by mapbox.
the class NavigationTelemetry method updateFeedbackEvent.
/**
* Updates an existing feedback event generated by {@link MapboxNavigation#recordFeedback(String, String, String)}.
* <p>
* Uses a feedback ID to find the correct event and then adjusts the feedbackType and description.
*
* @param feedbackId generated from {@link MapboxNavigation#recordFeedback(String, String, String)}
* @param feedbackType from list of set feedback types
* @param description an optional description to provide more detail about the feedback
* @param screenshot an optional encoded screenshot to provide more detail about the feedback
*/
void updateFeedbackEvent(String feedbackId, @FeedbackEvent.FeedbackType String feedbackType, String description, String screenshot) {
// Find the event and update
FeedbackEvent feedbackEvent = (FeedbackEvent) findQueuedTelemetryEvent(feedbackId);
if (feedbackEvent != null) {
feedbackEvent.setFeedbackType(feedbackType);
feedbackEvent.setDescription(description);
feedbackEvent.setScreenshot(screenshot);
}
}
use of com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation in project mapbox-navigation-android by mapbox.
the class NavigationTelemetry method updateSessionRoute.
/**
* Called when a new {@link DirectionsRoute} is given in
* {@link MapboxNavigation#startNavigation(DirectionsRoute)}.
* <p>
* At this point, navigation has already begun and the {@link SessionState}
* needs to be updated.
*
* @param directionsRoute new route passed to {@link MapboxNavigation}
*/
void updateSessionRoute(DirectionsRoute directionsRoute) {
SessionState.Builder navigationBuilder = navigationSessionState.toBuilder();
navigationBuilder.currentDirectionRoute(directionsRoute);
if (isOffRoute) {
// If we are off-route, update the reroute count
navigationBuilder.rerouteCount(navigationSessionState.rerouteCount() + 1);
boolean hasRouteOptions = directionsRoute.routeOptions() != null;
navigationBuilder.requestIdentifier(hasRouteOptions ? directionsRoute.routeOptions().requestUuid() : null);
navigationSessionState = navigationBuilder.build();
updateLastRerouteEvent(directionsRoute);
lastRerouteDate = new Date();
isOffRoute = false;
} else {
// Not current off-route - just update the session
navigationSessionState = navigationBuilder.build();
}
}
use of com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation in project mapbox-navigation-android by mapbox.
the class NavigationCameraTest method onResumeWithNullLocation_progressListenerIsAdded.
@Test
public void onResumeWithNullLocation_progressListenerIsAdded() throws Exception {
MapboxNavigation navigation = mock(MapboxNavigation.class);
ProgressChangeListener listener = mock(ProgressChangeListener.class);
NavigationCamera camera = buildCamera(navigation, listener);
camera.resume(null);
verify(navigation, times(1)).addProgressChangeListener(listener);
}
Aggregations