Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ext {
mapboxMapSdk : '6.6.1',
mapboxSdkServices : '4.0.0',
mapboxEvents : '3.4.0',
mapboxNavigator : '3.1.5',
mapboxNavigator : '3.2.0',
locationLayerPlugin: '0.10.0',
autoValue : '1.5.4',
autoValueParcel : '0.2.5',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.mapbox.api.directions.v5.models.StepIntersection;
import com.mapbox.geojson.Point;
import com.mapbox.navigator.NavigationStatus;
import com.mapbox.navigator.RouteState;
import com.mapbox.navigator.VoiceInstruction;
import com.mapbox.services.android.navigation.v5.routeprogress.CurrentLegAnnotation;
import com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress;
Expand All @@ -27,7 +26,7 @@
class NavigationRouteProcessor {

private static final int ONE_INDEX = 1;
private static final long ONE_SECOND_IN_MILLISECONDS = 1000L;
private static final double ONE_SECOND_IN_MILLISECONDS = 1000.0;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using double here so we dont truncate below. not sure if we really need subsecond accuracy, but its there if we need 😄

private RouteProgress previousRouteProgress;
private DirectionsRoute route;
private RouteLeg currentLeg;
Expand Down Expand Up @@ -71,8 +70,7 @@ private RouteProgress buildRouteProgressFrom(NavigationStatus status) {
double routeDistanceRemaining = routeDistanceRemaining(legDistanceRemaining, legIndex, route);
double stepDistanceRemaining = status.getRemainingStepDistance();
double stepDistanceTraveled = currentStep.distance() - stepDistanceRemaining;
double legDurationRemaining = status.getRouteState() == RouteState.TRACKING
? status.getRemainingLegDuration() / ONE_SECOND_IN_MILLISECONDS : route.duration();
double legDurationRemaining = status.getRemainingLegDuration() / ONE_SECOND_IN_MILLISECONDS;

currentLegAnnotation = createCurrentAnnotation(currentLegAnnotation, currentLeg, legDistanceRemaining);
StepIntersection currentIntersection = findCurrentIntersection(
Expand Down