added displaying all locations upon stopping the route

This commit is contained in:
Sem van der Hoeven
2021-01-06 11:33:15 +01:00
parent f6af7ae80b
commit f5da1c8a83
10 changed files with 95 additions and 32 deletions

View File

@@ -1,5 +1,7 @@
package com.a1.nextlocation.data;
import org.osmdroid.views.overlay.Polyline;
/**
* singleton to track the current route that is being followed
*/
@@ -9,6 +11,21 @@ public enum RouteHandler {
private boolean isFollowingRoute = false;
private Route currentRoute;
private int stepCount = 0;
private RouteFinishedListener routeFinishedListener;
private Polyline currentRouteLine;
public void setCurrentRouteLine(Polyline currentRouteLine) {
this.currentRouteLine = currentRouteLine;
}
public Polyline getCurrentRouteLine() {
return currentRouteLine;
}
public void setRouteFinishedListener(RouteFinishedListener routeFinishedListener) {
this.routeFinishedListener = routeFinishedListener;
}
public int getStepCount() {
return stepCount;
@@ -22,6 +39,7 @@ public enum RouteHandler {
stepCount = 0;
isFollowingRoute = false;
currentRoute = null;
currentRouteLine = null;
}
public void followRoute(Route route) {
@@ -39,4 +57,13 @@ public enum RouteHandler {
public boolean isFollowingRoute() {
return isFollowingRoute;
}
public Route getCurrentRoute() {
return currentRoute;
}
@FunctionalInterface
public interface RouteFinishedListener {
void onRouteFinish();
}
}

View File

@@ -34,14 +34,6 @@ public enum StaticData {
return locationsVisited;
}
private Polyline currentRoute;
public void setCurrentRoute(Polyline currentRoute) {
this.currentRoute = currentRoute;
}
public Polyline getCurrentRoute() {
return currentRoute;
}
}