From 2bffd9cfb7423bd43fd92e3075123083913c37d5 Mon Sep 17 00:00:00 2001 From: Langston Smith Date: Tue, 21 Apr 2020 08:42:31 -0700 Subject: [PATCH] added baseUrl to PlaceOptions --- .../autocomplete/model/PlaceOptions.java | 22 ++++++++++++++++++- .../viewmodel/PlaceAutocompleteViewModel.java | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/model/PlaceOptions.java b/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/model/PlaceOptions.java index 19264983e..d35963a1d 100644 --- a/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/model/PlaceOptions.java +++ b/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/model/PlaceOptions.java @@ -29,7 +29,7 @@ *
  • Full screen mode: will place all the search history, results, and injected * places into a view which has a width equal to the app width.
  • *
  • Card view mode: the place search history, results, and injected places in - * an Android Support Library {@link android.support.v7.widget.CardView}
  • + * into a {@link androidx.cardview.widget.CardView} * * * @since 0.1.0 @@ -190,6 +190,16 @@ public abstract class PlaceOptions implements Parcelable { @Nullable public abstract String hint(); + /** + * Optionally change the base URL of the geocoding request + * to something other then the default Mapbox one. + * + * @return base url of geocoding request + * @since 0.12.0 + */ + @Nullable + public abstract String baseUrl(); + /** * Build a new instance of the {@link PlaceOptions} class using this method. It will return the * {@link Builder} which can be used to customize the users experience. @@ -429,6 +439,16 @@ public Builder addInjectedFeature(CarmenFeature carmenFeature) { */ public abstract Builder hint(@Nullable String hint); + /** + * Optionally change the base URL of the geocoding request + * to something other then the default Mapbox one. + * + * @param baseUrl base url of geocoding request + * @return this builder instance for chaining options together + * @since 0.12.0 + */ + public abstract Builder baseUrl(@Nullable String baseUrl); + abstract PlaceOptions autoBuild(); /** diff --git a/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/viewmodel/PlaceAutocompleteViewModel.java b/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/viewmodel/PlaceAutocompleteViewModel.java index a8315da86..2e35f3592 100644 --- a/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/viewmodel/PlaceAutocompleteViewModel.java +++ b/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/viewmodel/PlaceAutocompleteViewModel.java @@ -43,6 +43,9 @@ public void buildGeocodingRequest(String accessToken) { geocoderBuilder = MapboxGeocoding.builder().autocomplete(true); geocoderBuilder.accessToken(accessToken); geocoderBuilder.limit(placeOptions.limit()); + if (placeOptions.baseUrl() != null) { + geocoderBuilder.baseUrl(placeOptions.baseUrl()); + } // Proximity Point proximityPoint = placeOptions.proximity();