added updating time when you start a route but are already following another one

This commit is contained in:
Sem van der Hoeven
2021-01-06 16:20:03 +01:00
parent c412f36e6c
commit fb2f7e8a66
2 changed files with 15 additions and 2 deletions

View File

@@ -46,6 +46,9 @@ public enum RouteHandler {
}
public void followRoute(Route route) {
if (isFollowingRoute) {
StaticData.INSTANCE.addTimeWalked(System.currentTimeMillis()-startedTime);
}
this.currentRoute = route;
setFollowingRoute(true);
startedTime = System.currentTimeMillis();

View File

@@ -109,8 +109,8 @@ public class DirectionsResult {
}
/**
* parses the given json string into this object. This method is used for when you want to
* @param json
* parses the given json string into this object. This method is used for when you have requested directions from the API for a {@link com.a1.nextlocation.data.Route route object}
* @param json the json string
*/
public void parseRoute(String json) {
@@ -145,6 +145,11 @@ public class DirectionsResult {
}
/**
* parses different segments, and the steps in it using {@link DirectionsResult#parseSteps(JsonArray, Gson) the method for parsing steps}
* @param segments the segments to parse
* @param gson the gson object to use
*/
private void parseSegments(JsonArray segments, Gson gson) {
//unfold the individual segments
for (JsonElement e : segments) {
@@ -159,6 +164,11 @@ public class DirectionsResult {
}
}
/**
* parses the given steps into this object, transforms them into a {@link DirectionsStep} object.
* @param steps the steps to parse
* @param gson the gson object to use
*/
private void parseSteps(JsonArray steps, Gson gson) {
for (JsonElement j : steps) {