added visited locations in route
This commit is contained in:
@@ -112,4 +112,13 @@ public class Route implements Parcelable {
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setLocationVisited(Location location) {
|
||||
for (Location l : this.locations) {
|
||||
if (l.getName().equals(location.getName())) {
|
||||
l.setVisited(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,14 @@ public enum RouteHandler {
|
||||
Data.INSTANCE.addTimeWalked(System.currentTimeMillis() - startedTime);
|
||||
}
|
||||
this.currentRoute = route;
|
||||
|
||||
// sync the visited locations with the route
|
||||
for (Location l : this.currentRoute.getLocations()) {
|
||||
if (Data.INSTANCE.isVisited(l)) {
|
||||
this.currentRoute.setLocationVisited(l);
|
||||
}
|
||||
}
|
||||
|
||||
setFollowingRoute(true);
|
||||
startedTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user