Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ directions-fixtures:
-o mapbox/libjava-services/src/test/fixtures/directions_v5.json

# Directions: request annotations
curl "https://api.mapbox.com/directions/v5/mapbox/driving/-122.416667,37.783333;-121.900000,37.333333?geometries=polyline&steps=true&annotations=distance,duration,speed&access_token=$(MAPBOX_ACCESS_TOKEN)" \
curl "https://api.mapbox.com/directions/v5/mapbox/driving/-122.416667,37.783333;-121.900000,37.333333?geometries=polyline&language=sv&steps=true&annotations=distance,duration,speed&access_token=$(MAPBOX_ACCESS_TOKEN)" \
-o mapbox/libjava-services/src/test/fixtures/directions_annotations_v5.json

# Directions: polyline geometry with precision 6
curl "https://api.mapbox.com/directions/v5/mapbox/driving/-122.416667,37.783333;-121.900000,37.333333?geometries=polyline6&steps=true&access_token=$(MAPBOX_ACCESS_TOKEN)" \
-o mapbox/libjava-services/src/test/fixtures/directions_v5_precision_6.json

directions-fixtures-rotary:
# Directions: route with a rotary
curl "https://api.mapbox.com/directions/v5/mapbox/driving/-77.04430818557739,38.908650612656864;-77.04192638397217,38.90963574367117?geometries=polyline&steps=true&access_token=$(MAPBOX_ACCESS_TOKEN)" \
-o mapbox/libjava-services/src/test/fixtures/directions_v5_fixtures_rotary.json

directions-traffic-fixtures:
# Directions: route with traffic
curl "https://api.mapbox.com/directions/v5/mapbox/driving-traffic/-122.416667,37.783333;-121.900000,37.333333?geometries=polyline&steps=true&access_token=$(MAPBOX_ACCESS_TOKEN)" \
-o mapbox/libjava-services/src/test/fixtures/directions_v5_traffic.json

Expand Down
2 changes: 1 addition & 1 deletion mapbox/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.2'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ public interface DirectionsServiceRx {
* the angle of approach
* @param continueStraight Define whether the route should continue straight even if the route
* will be slower.
* @param annotations An annotations object that contains additional details about each line segment along the
* @param annotations An annotations object that contains additional details about each line segment along the
* route geometry. Each entry in an annotations field corresponds to a coordinate along the
* route geometry.
* @param language Language of returned turn-by-turn text instructions.
* @return A retrofit Observable object
* @since 2.0.0
*/
Expand All @@ -52,6 +53,7 @@ Observable<DirectionsResponse> getObservable(
@Query("steps") Boolean steps,
@Query("bearings") String bearings,
@Query("continue_straight") Boolean continueStraight,
@Query("annotations") String annotations
@Query("annotations") String annotations,
@Query("language") String language
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public Observable<DirectionsResponse> getObservable() {
builder.isSteps(),
builder.getBearings(),
builder.isContinueStraight(),
builder.getAnnotation());
builder.getAnnotation(),
builder.getLanguage());

// Done
return observable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public interface DirectionsService {
* @param annotations An annotations object that contains additional details about each line segment along the
* route geometry. Each entry in an annotations field corresponds to a coordinate along the
* route geometry.
* @param language Language of returned turn-by-turn text instructions.
* @return The {@link DirectionsResponse} in a Call wrapper.
* @since 1.0.0
*/
Expand All @@ -53,6 +54,7 @@ Call<DirectionsResponse> getCall(
@Query("steps") Boolean steps,
@Query("bearings") String bearings,
@Query("continue_straight") Boolean continueStraight,
@Query("annotations") String annotations
@Query("annotations") String annotations,
@Query("language") String language
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ private Call<DirectionsResponse> getCall() {
builder.isSteps(),
builder.getBearings(),
builder.isContinueStraight(),
builder.getAnnotation());
builder.getAnnotation(),
builder.getLanguage());

// Done
return call;
Expand Down Expand Up @@ -147,6 +148,7 @@ public static class Builder<T extends Builder> extends MapboxBuilder {
private Position origin = null;
private Position destination = null;
private String[] annotation = null;
private String language = null;

/**
* Constructor
Expand All @@ -157,7 +159,7 @@ public Builder() {
// Set defaults
this.user = DirectionsCriteria.PROFILE_DEFAULT_USER;

// by defauly the geometry is polyline with precision 6.
// by default the geometry is polyline with precision 6.
this.geometries = DirectionsCriteria.GEOMETRY_POLYLINE6;
}

Expand Down Expand Up @@ -358,6 +360,19 @@ public T setAnnotation(String... annotation) {
return (T) this;
}

/**
* Optionally set the language of returned turn-by-turn text instructions. The default is {@code en} for English.
*
* @param language The locale in which results should be returned.
* @return Builder
* @see <a href="https://www.mapbox.com/api-documentation/#instructions-languages">Supported languages</a>
* @since 2.2.0
*/
public T setLanguage(String language) {
this.language = language;
return (T) this;
}

/*
* Getters, they return the value in a format ready for the API to consume
*/
Expand Down Expand Up @@ -543,6 +558,14 @@ public String getAnnotation() {
return TextUtils.join(",", annotation);
}

/**
* @return The language the turn-by-turn directions will be in.
* @since 2.2.0
*/
public String getLanguage() {
return language;
}

/**
* Base package name or other simple string identifier
*
Expand Down
Loading