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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class NavigationRouteProcessor {

private static final int ONE_INDEX = 1;
public static final int ONE_SECOND = 1000;
private static final long ONE_SECOND_IN_MILLISECONDS = 1000L;
private RouteProgress previousRouteProgress;
private DirectionsRoute route;
private RouteLeg currentLeg;
Expand Down Expand Up @@ -72,7 +72,7 @@ private RouteProgress buildRouteProgressFrom(NavigationStatus status) {
double stepDistanceRemaining = status.getRemainingStepDistance();
double stepDistanceTraveled = currentStep.distance() - stepDistanceRemaining;
double legDurationRemaining = status.getRouteState() == RouteState.TRACKING
? status.getRemainingLegDuration() / ONE_SECOND : route.duration();
? status.getRemainingLegDuration() / ONE_SECOND_IN_MILLISECONDS : route.duration();

currentLegAnnotation = createCurrentAnnotation(currentLegAnnotation, currentLeg, legDistanceRemaining);
StepIntersection currentIntersection = findCurrentIntersection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import timber.log.Timber;

public class TimeFormatter {

private static final String TIME_STRING_FORMAT = " %s ";
Expand All @@ -33,7 +35,8 @@ public static SpannableStringBuilder formatTimeRemaining(Context context, double
long seconds = (long) routeDuration;

if (seconds < 0) {
throw new IllegalArgumentException("Duration must be greater than zero.");
Timber.e("Duration must be greater than zero. Invalid duration %s", seconds);
seconds = 0L;
}

long days = TimeUnit.SECONDS.toDays(seconds);
Expand Down