Skip to content

Commit

Permalink
37 merged to master
Browse files Browse the repository at this point in the history
  • Loading branch information
landgenoot committed Dec 13, 2018
1 parent ac1f480 commit 34c9452
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ android {
}
buildTypes {
release {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/amos/corridornavigation/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ public void onNavigateButtonClicked(View view) {
try {
boolean simulateRoute = true;
NavigationLauncherOptions options = NavigationLauncherOptions.builder()
.directionsRoute(super.locationMarker.currentRoute)
.shouldSimulateRoute(simulateRoute)
.defaultMilestonesEnabled(false)
.directionsRoute(super.locationMarker.currentRoute.get(0))
.build();


int max=options.directionsRoute().legs().get(0).steps().size();
for(int i = 0; i<max;i++) {
Log.d("instruction", options.directionsRoute().legs().get(0).steps().get(i).maneuver().instruction());
// Log.d("instruction", options.directionsRoute().legs().get(0).steps().get(i).maneuver().instruction());
}

// Call this method with Context from within an Activity
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/amos/corridornavigation/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute;
import com.mapbox.services.android.navigation.v5.navigation.NavigationRoute;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
Expand All @@ -23,7 +25,7 @@ public class Router {
private Marker destinationMarkerPosition;
protected LatLng destinationCoord;

protected DirectionsRoute currentRoute;
public List<DirectionsRoute> currentRoute;
private NavigationMapRoute navigationMapRoute;

public Router()
Expand Down Expand Up @@ -81,15 +83,15 @@ public void onResponse(Call<DirectionsResponse> call, Response<DirectionsRespons
return;
}

currentRoute = response.body().routes().get(0);
currentRoute = response.body().routes();

// Draw the route on the map
if (navigationMapRoute != null) {
navigationMapRoute.removeRoute();
} else {
int condition = 0;
if (condition == 0) {
navigationMapRoute = new NavigationMapRoute(null, context.mapView, context.mapboxMap, R.style.NavigationMapRouteGreen);
navigationMapRoute = new NavigationMapRoute(null, context.mapView, context.mapboxMap, R.style.NavigationMapRoute);
}
else if (condition == 1) {
navigationMapRoute = new NavigationMapRoute(null, context.mapView, context.mapboxMap, R.style.NavigationMapRouteYellow);
Expand All @@ -99,7 +101,7 @@ else if (condition == 1) {
}
//navigationMapRoute = new NavigationMapRoute(null, context.mapView, context.mapboxMap, R.style.NavigationMapRoute);
}
navigationMapRoute.addRoute(currentRoute);
navigationMapRoute.addRoutes(currentRoute);
}

@Override
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
<color name="colorPrimaryDark">#727E8D</color>
<color name="colorAccent">#ffffff</color>
<color name="colorSearchbar">#ffffff</color>
<color name="mapbox_navigation_route_alternative_color">#7ebcfb</color>
<color name="mapbox_navigation_route_alternative_congestion_red">#e9646d</color>
<color name="mapbox_navigation_route_alternative_congestion_yellow">#f3b773</color>

</resources>

0 comments on commit 34c9452

Please sign in to comment.