added saving route duration
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user