diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2019-06-04 10:10:50 +0200 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2019-06-05 09:38:20 +0200 |
commit | 36361192b1b55a272b6115876ffe18be55f6b964 (patch) | |
tree | c304dac2134c619de2556be7e48a74bb18f28327 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | |
parent | a5f7f73dfefbcb92e44cd26bfeb894ca425c893a (diff) | |
download | qtlocation-mapboxgl-36361192b1b55a272b6115876ffe18be55f6b964.tar.gz |
[android] - rename style component URL api to URI
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 389cb0a0a9..cc2124c6c7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -11,9 +11,9 @@ import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.res.ResourcesCompat; +import android.text.TextUtils; import android.util.AttributeSet; import android.view.Gravity; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; @@ -70,7 +70,7 @@ public class MapboxMapOptions implements Parcelable { private boolean zMediaOverlay = false; private String localIdeographFontFamily = "sans-serif"; - private String apiBaseUrl; + private String apiBaseUri; private boolean textureMode; private boolean translucentTextureSurface; @@ -84,6 +84,7 @@ public class MapboxMapOptions implements Parcelable { /** * Creates a new MapboxMapOptions object. + * * @deprecated Use {@link #createFromAttributes(Context, AttributeSet)} instead. */ @Deprecated @@ -123,7 +124,7 @@ public class MapboxMapOptions implements Parcelable { doubleTapGesturesEnabled = in.readByte() != 0; quickZoomGesturesEnabled = in.readByte() != 0; - apiBaseUrl = in.readString(); + apiBaseUri = in.readString(); textureMode = in.readByte() != 0; translucentTextureSurface = in.readByte() != 0; prefetchesTiles = in.readByte() != 0; @@ -148,8 +149,16 @@ public class MapboxMapOptions implements Parcelable { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.mapbox_MapView, 0, 0); try { mapboxMapOptions.camera(new CameraPosition.Builder(typedArray).build()); + + // deprecated mapboxMapOptions.apiBaseUrl(typedArray.getString(R.styleable.mapbox_MapView_mapbox_apiBaseUrl)); + String baseUri = typedArray.getString(R.styleable.mapbox_MapView_mapbox_apiBaseUri); + if (!TextUtils.isEmpty(baseUri)) { + // override deprecated property if a value of the new type was provided + mapboxMapOptions.apiBaseUri(baseUri); + } + mapboxMapOptions.zoomGesturesEnabled( typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_uiZoomGestures, true)); mapboxMapOptions.scrollGesturesEnabled( @@ -246,10 +255,24 @@ public class MapboxMapOptions implements Parcelable { * * @param apiBaseUrl The base of our API endpoint * @return This + * @deprecated use {@link #apiBaseUri} instead */ + @Deprecated @NonNull public MapboxMapOptions apiBaseUrl(String apiBaseUrl) { - this.apiBaseUrl = apiBaseUrl; + this.apiBaseUri = apiBaseUrl; + return this; + } + + /** + * Specifies the URI used for API endpoint. + * + * @param apiBaseUri The base of our API endpoint + * @return This + */ + @NonNull + public MapboxMapOptions apiBaseUri(String apiBaseUri) { + this.apiBaseUri = apiBaseUri; return this; } @@ -660,9 +683,20 @@ public class MapboxMapOptions implements Parcelable { * Get the current configured API endpoint base URL. * * @return Base URL to be used API endpoint. + * @deprecated use {@link #getApiBaseUri()} instead */ + @Deprecated public String getApiBaseUrl() { - return apiBaseUrl; + return apiBaseUri; + } + + /** + * Get the current configured API endpoint base URI. + * + * @return Base URI to be used API endpoint. + */ + public String getApiBaseUri() { + return apiBaseUri; } /** @@ -953,7 +987,7 @@ public class MapboxMapOptions implements Parcelable { dest.writeByte((byte) (doubleTapGesturesEnabled ? 1 : 0)); dest.writeByte((byte) (quickZoomGesturesEnabled ? 1 : 0)); - dest.writeString(apiBaseUrl); + dest.writeString(apiBaseUri); dest.writeByte((byte) (textureMode ? 1 : 0)); dest.writeByte((byte) (translucentTextureSurface ? 1 : 0)); dest.writeByte((byte) (prefetchesTiles ? 1 : 0)); @@ -1044,7 +1078,7 @@ public class MapboxMapOptions implements Parcelable { return false; } - if (apiBaseUrl != null ? !apiBaseUrl.equals(options.apiBaseUrl) : options.apiBaseUrl != null) { + if (apiBaseUri != null ? !apiBaseUri.equals(options.apiBaseUri) : options.apiBaseUri != null) { return false; } if (prefetchesTiles != options.prefetchesTiles) { @@ -1095,7 +1129,7 @@ public class MapboxMapOptions implements Parcelable { result = 31 * result + (zoomGesturesEnabled ? 1 : 0); result = 31 * result + (doubleTapGesturesEnabled ? 1 : 0); result = 31 * result + (quickZoomGesturesEnabled ? 1 : 0); - result = 31 * result + (apiBaseUrl != null ? apiBaseUrl.hashCode() : 0); + result = 31 * result + (apiBaseUri != null ? apiBaseUri.hashCode() : 0); result = 31 * result + (textureMode ? 1 : 0); result = 31 * result + (translucentTextureSurface ? 1 : 0); result = 31 * result + (prefetchesTiles ? 1 : 0); |