Color of RouteLineColorResources:routeLineTraveledColor, this function is not working and is not changing the travelled path color.
This is the code I have implemented in my project:
RouteLineColorResources routeLineResources = new RouteLineColorResources.Builder() .routeLineTraveledColor(Color.parseColor("#000000")) .routeLineTraveledCasingColor(Color.parseColor("#ffffff")) .alternativeRouteCasingColor(Color.parseColor("#ffffff"))
.build();
RouteLineResources routeLineResources1 = new RouteLineResources.Builder()
.routeLineColorResources(routeLineResources)
.build();
MapboxRouteLineOptions mapboxRouteLineOptions = new MapboxRouteLineOptions.Builder(DayHikeActivity.this)
.withVanishingRouteLineEnabled(true)
.withRouteLineBelowLayerId("road-label")
.withRouteLineResources(routeLineResources1)
.build();
routeLineApi = new MapboxRouteLineApi(mapboxRouteLineOptions);
routeLineView = new MapboxRouteLineView(mapboxRouteLineOptions);
RouteArrowOptions routeArrowOptions = new RouteArrowOptions.Builder(DayHikeActivity.this).build();
routeArrowView = new MapboxRouteArrowView(routeArrowOptions);
LocationComponentPlugin locationComponentPlugin = LocationComponentUtils.getLocationComponent((MapPluginProviderDelegate) mBinding.mapView);
locationComponentPlugin.setLocationProvider((LocationProvider) navigationLocationProvider);
locationComponentPlugin.setEnabled(true);
locationComponentPlugin.addOnIndicatorPositionChangedListener(onIndicatorPositionChangedListener);
Android API:
Mapbox Navigation SDK version: The navigation SDK version is 0.42.6
Steps to trigger behavior
- Generate path routes
- Start Navigation from origin point to destination point
- The path travelled by user, color of travelled path is not getting changed
Expected behavior
After giving the routeLineTraveledColor is Yellow, the path color should change
Actual behavior
After giving the routeLineTraveledColor is Yellow, the path color is not getting changed
@tobrun Please look into this
@appenvturez-siddharth 0.42.6 is a very old version and it is not supported anymore. Could you update to the latest version (which is 2.4.1) and try to reproduce the issue then?
@appenvturez-siddharth
0.42.6is a very old version and it is not supported anymore. Could you update to the latest version (which is2.4.1) and try to reproduce the issue then?
Sure let me try with the new version.
@Zayankovsky I tried with the new sdk version but the issue is still not fixed
@appenvturez-siddharth unfortunately I'm not able to reproduce the issue using the information you provided. Could you share the code that you use to draw the routes? Also I recommend to look at the examples. e.g. MapboxRouteLineAndArrowActivity.kt showcases the usage of withVanishingRouteLineEnabled and routeLineTraveledColor, which is exactly what you are trying to do.
There are two things that need to happen in order to to use this feature. Both OnIndicatorPositionChangedListener and RouteProgressObserver need to be registered and the route line API utilized similar to the code snippets below.
private val onPositionChangedListener = OnIndicatorPositionChangedListener { point ->
val result = routeLineApi.updateTraveledRouteLine(point)
mapboxMap.getStyle()?.apply {
routeLineView.renderRouteLineUpdate(this, result)
}
}
private val routeProgressObserver = RouteProgressObserver { routeProgress ->
routeLineApi.updateWithRouteProgress(routeProgress) { result ->
mapboxMap.getStyle()?.apply {
routeLineView.renderRouteLineUpdate(this, result)
}
}
}
Closing this due to lack of activity.