File tree Expand file tree Collapse file tree
samples/src/main/java/com/mapbox/samples
services-directions/src/main/java/com/mapbox/directions/v5 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ private static MapboxDirections buildMapboxDirections() {
5454 .addBearing (null , null )
5555 .radiuses (Double .POSITIVE_INFINITY , Double .POSITIVE_INFINITY )
5656 .steps (true )
57+ .voiceUnits (DirectionsCriteria .METRIC )
5758 .build ();
5859 }
5960}
Original file line number Diff line number Diff line change @@ -211,6 +211,18 @@ private DirectionsCriteria() {
211211 public @interface ExcludeCriteria {
212212 }
213213
214+ public static final String IMPERIAL = "imperial" ;
215+
216+ public static final String METRIC = "metric" ;
217+
218+ @ Retention (RetentionPolicy .SOURCE )
219+ @ StringDef ( {
220+ IMPERIAL ,
221+ METRIC
222+ })
223+ public @interface VoiceUnitCriteria {
224+ }
225+
214226 // Optimization API criteria's
215227
216228 /**
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ Call<DirectionsResponse> getCall(
6464 @ Query ("roundabout_exits" ) Boolean roundaboutExits ,
6565 @ Query ("voice_instructions" ) Boolean voiceInstructions ,
6666 @ Query ("banner_instructions" ) Boolean bannerInstructions ,
67+ @ Query ("voice_units" ) String voiceUnits ,
6768 @ Query ("exclude" ) String exclude
6869 );
6970}
Original file line number Diff line number Diff line change 1212import com .mapbox .directions .v5 .DirectionsCriteria .GeometriesCriteria ;
1313import com .mapbox .directions .v5 .DirectionsCriteria .OverviewCriteria ;
1414import com .mapbox .directions .v5 .DirectionsCriteria .ProfileCriteria ;
15+ import com .mapbox .directions .v5 .DirectionsCriteria .VoiceUnitCriteria ;
1516import com .mapbox .directions .v5 .models .DirectionsError ;
1617import com .mapbox .directions .v5 .models .DirectionsResponse ;
1718import com .mapbox .directions .v5 .models .DirectionsRoute ;
@@ -109,6 +110,7 @@ private Call<DirectionsResponse> getCall() {
109110 roundaboutExits (),
110111 voiceInstructions (),
111112 bannerInstructions (),
113+ voiceUnits (),
112114 exclude ());
113115
114116 // Done
@@ -199,6 +201,7 @@ private List<DirectionsRoute> generateRouteOptions(List<DirectionsRoute> routes)
199201 .voiceInstructions (voiceInstructions ())
200202 .bannerInstructions (bannerInstructions ())
201203 .exclude (exclude ())
204+ .voiceUnits (voiceUnits ())
202205 .build ()
203206 ).build ());
204207 }
@@ -281,6 +284,9 @@ public Call<DirectionsResponse> cloneCall() {
281284 @ Nullable
282285 abstract Boolean bannerInstructions ();
283286
287+ @ Nullable
288+ abstract String voiceUnits ();
289+
284290 @ Nullable
285291 abstract String exclude ();
286292
@@ -644,6 +650,8 @@ public Builder radiuses(@FloatRange(from = 0) double... radiuses) {
644650 */
645651 public abstract Builder bannerInstructions (@ Nullable Boolean bannerInstructions );
646652
653+ public abstract Builder voiceUnits (@ Nullable @ VoiceUnitCriteria String voiceUnits );
654+
647655 /**
648656 * Base package name or other simple string identifier. Used inside the calls user agent header.
649657 *
Original file line number Diff line number Diff line change @@ -137,6 +137,8 @@ public static Builder builder() {
137137 @ Nullable
138138 public abstract Boolean bannerInstructions ();
139139
140+ public abstract String voiceUnits ();
141+
140142 /**
141143 * Gson type adapter for parsing Gson to this class.
142144 *
@@ -244,6 +246,8 @@ public abstract static class Builder {
244246
245247 public abstract Builder bannerInstructions (Boolean bannerInstructions );
246248
249+ public abstract Builder voiceUnits (String voiceUnits );
250+
247251 /**
248252 * The same exclusions the user originally made when the request was made.
249253 *
You can’t perform that action at this time.
0 commit comments