added saving route duration

This commit is contained in:
Sem van der Hoeven
2021-01-12 13:51:50 +01:00
parent 5544da5d2e
commit 39ff2684cb
3 changed files with 14 additions and 0 deletions

View File

@@ -13,6 +13,15 @@ public enum RouteHandler {
private int stepCount = 0;
private RouteFinishedListener routeFinishedListener;
private long startedTime;
private double currentRouteDuration;
public void setCurrentRouteDuration(double currentRouteDuration) {
this.currentRouteDuration = currentRouteDuration;
}
public double getCurrentRouteDuration() {
return currentRouteDuration;
}
private Polyline currentRouteLine;
@@ -20,6 +29,7 @@ public enum RouteHandler {
this.currentRouteLine = currentRouteLine;
}
public Polyline getCurrentRouteLine() {
return currentRouteLine;
}

View File

@@ -139,6 +139,7 @@ public class HomeFragment extends Fragment implements LocationListener {
roadOverlay.setColor(color);
// pass the line to the route handler
RouteHandler.INSTANCE.setCurrentRouteDuration(directionsResult.getDuration());
RouteHandler.INSTANCE.setCurrentRouteLine(roadOverlay);
Log.d(TAG, "onDirectionsAvailable: successfully added road!");

View File

@@ -14,6 +14,9 @@ import com.google.android.gms.location.GeofencingEvent;
import java.util.List;
/**
* broadcast receiver for geofence events
*/
public class GeoFenceBroadcastReceiver extends BroadcastReceiver {
private final String TAG = GeoFenceBroadcastReceiver.class.getCanonicalName();