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 | |
parent | a5f7f73dfefbcb92e44cd26bfeb894ca425c893a (diff) | |
download | qtlocation-mapboxgl-36361192b1b55a272b6115876ffe18be55f6b964.tar.gz |
[android] - rename style component URL api to URI
Diffstat (limited to 'platform')
40 files changed, 215 insertions, 92 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index fa34e5b1f7..ea06856e9e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -704,7 +704,7 @@ public final class MapboxMap { moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); setMinZoomPreference(minZoom); setMaxZoomPreference(maxZoom); - setStyle(new Style.Builder().fromUrl(definition.getStyleURL()), callback); + setStyle(new Style.Builder().fromUri(definition.getStyleURL()), callback); } // @@ -793,7 +793,7 @@ public final class MapboxMap { * @see Style */ public void setStyle(@Style.StyleUrl String style, final Style.OnStyleLoaded callback) { - this.setStyle(new Style.Builder().fromUrl(style), callback); + this.setStyle(new Style.Builder().fromUri(style), callback); } /** @@ -831,8 +831,8 @@ public final class MapboxMap { } style = builder.build(nativeMapView); - if (!TextUtils.isEmpty(builder.getUrl())) { - nativeMapView.setStyleUrl(builder.getUrl()); + if (!TextUtils.isEmpty(builder.getUri())) { + nativeMapView.setStyleUri(builder.getUri()); } else if (!TextUtils.isEmpty(builder.getJson())) { nativeMapView.setStyleJson(builder.getJson()); } else { 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); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java index 66038e4d45..7692c1a9f2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java @@ -102,10 +102,10 @@ interface NativeMap { // Style API // - void setStyleUrl(String url); + void setStyleUri(String url); @NonNull - String getStyleUrl(); + String getStyleUri(); void setStyleJson(String newStyleJson); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 4e774d9f2c..fc68a408fa 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -171,8 +171,8 @@ final class NativeMapView implements NativeMap { } @Override - public void setStyleUrl(String url) { - if (checkState("setStyleUrl")) { + public void setStyleUri(String url) { + if (checkState("setStyleUri")) { return; } nativeSetStyleUrl(url); @@ -180,8 +180,8 @@ final class NativeMapView implements NativeMap { @Override @NonNull - public String getStyleUrl() { - if (checkState("getStyleUrl")) { + public String getStyleUri() { + if (checkState("getStyleUri")) { return ""; } return nativeGetStyleUrl(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java index c8f7ee6978..07e0daef54 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java @@ -59,11 +59,24 @@ public class Style { * Returns the current style url. * * @return the style url + * @deprecated use {@link #getUri()} instead */ @NonNull + @Deprecated public String getUrl() { validateState("getUrl"); - return nativeMap.getStyleUrl(); + return nativeMap.getStyleUri(); + } + + /** + * Returns the current style uri. + * + * @return the style uri + */ + @NonNull + public String getUri() { + validateState("getUri"); + return nativeMap.getStyleUri(); } /** @@ -600,7 +613,7 @@ public class Style { private final List<ImageWrapper> images = new ArrayList<>(); private TransitionOptions transitionOptions; - private String styleUrl; + private String styleUri; private String styleJson; /** @@ -637,17 +650,60 @@ public class Style { * @param url The URL of the map style * @return this * @see Style + * @deprecated use {@link #fromUri(String)} instead */ + @Deprecated @NonNull public Builder fromUrl(@NonNull String url) { - this.styleUrl = url; + this.styleUri = url; + return this; + } + + /** + * <p> + * Will loads a new map style asynchronous from the specified URI. + * </p> + * {@code uri} can take the following forms: + * <ul> + * <li>{@code Style#StyleUrl}: load one of the bundled styles in {@link Style}.</li> + * <li>{@code mapbox://styles/<user>/<style>}: + * loads the style from a <a href="https://www.mapbox.com/account/">Mapbox account.</a> + * {@code user} is your username. {@code style} is the ID of your custom + * style created in <a href="https://www.mapbox.com/studio">Mapbox Studio</a>.</li> + * <li>{@code http://...} or {@code https://...}: + * loads the style over the Internet from any web server.</li> + * <li>{@code asset://...}: + * loads the style from the APK {@code assets/} directory. + * This is used to load a style bundled with your app.</li> + * <li>{@code file://...}: + * loads the style from a file path. This is used to load a style from disk. + * </li> + * </li> + * <li>{@code null}: loads the default {@link Style#MAPBOX_STREETS} style.</li> + * </ul> + * <p> + * This method is asynchronous and will return before the style finishes loading. + * If you wish to wait for the map to finish loading, listen to the {@link MapView.OnDidFinishLoadingStyleListener} + * callback or use {@link MapboxMap#setStyle(String, OnStyleLoaded)} instead. + * </p> + * If the style fails to load or an invalid style URI is set, the map view will become blank. + * An error message will be logged in the Android logcat and {@link MapView.OnDidFailLoadingMapListener} callback + * will be triggered. + * + * @param uri The URI of the map style + * @return this + * @see Style + */ + @NonNull + public Builder fromUri(@NonNull String uri) { + this.styleUri = uri; return this; } /** * Will load a new map style from a json string. * <p> - * If the style fails to load or an invalid style URL is set, the map view will become blank. + * If the style fails to load or an invalid style URI is set, the map view will become blank. * An error message will be logged in the Android logcat and {@link MapView.OnDidFailLoadingMapListener} callback * will be triggered. * </p> @@ -876,8 +932,8 @@ public class Style { return this; } - String getUrl() { - return styleUrl; + String getUri() { + return styleUri; } String getJson() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java index 586234a0c2..e8e38c4f4e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java @@ -93,7 +93,7 @@ public class MapSnapshotter { private float pixelRatio = 1; private int width; private int height; - private String styleUrl = Style.MAPBOX_STREETS; + private String styleUri = Style.MAPBOX_STREETS; private String styleJson; private LatLngBounds region; private CameraPosition cameraPosition; @@ -114,12 +114,12 @@ public class MapSnapshotter { } /** - * @param url The style URL to use + * @param uri The style URI to use * @return the mutated {@link Options} */ @NonNull - public Options withStyle(String url) { - this.styleUrl = url; + public Options withStyle(String uri) { + this.styleUri = uri; return this; } @@ -198,7 +198,9 @@ public class MapSnapshotter { * * @param apiBaseUrl The base of our API endpoint * @return the mutated {@link Options} + * @deprecated use {@link #withApiBaseUri(String)} instead */ + @Deprecated @NonNull public Options withApiBaseUrl(String apiBaseUrl) { this.apiBaseUrl = apiBaseUrl; @@ -206,6 +208,18 @@ public class MapSnapshotter { } /** + * Specifies the URI used for API endpoint. + * + * @param apiBaseUri The base of our API endpoint + * @return the mutated {@link Options} + */ + @NonNull + public Options withApiBaseUri(String apiBaseUri) { + this.apiBaseUrl = apiBaseUrl; + return this; + } + + /** * @return the width of the image */ public int getWidth() { @@ -236,9 +250,18 @@ public class MapSnapshotter { /** * @return the style url + * @deprecated use {@link #getStyleUri()} instead */ + @Deprecated public String getStyleUrl() { - return styleUrl; + return styleUri; + } + + /** + * @return the style uri + */ + public String getStyleUri() { + return styleUri; } /** @@ -259,11 +282,21 @@ public class MapSnapshotter { /** * @return The base of our API endpoint + * @deprecated use {@link #getApiBaseUri()} instead */ @Nullable + @Deprecated public String getApiBaseUrl() { return apiBaseUrl; } + + /** + * @return The base of our API endpoint + */ + @Nullable + public String getApiBaseUri() { + return apiBaseUrl; + } } /** @@ -289,7 +322,7 @@ public class MapSnapshotter { String programCacheDir = FileSource.getInternalCachePath(context); nativeInitialize(this, fileSource, options.pixelRatio, options.width, - options.height, options.styleUrl, options.styleJson, options.region, options.cameraPosition, + options.height, options.styleUri, options.styleJson, options.region, options.cameraPosition, options.showLogo, programCacheDir, options.localIdeographFontFamily); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml index 0a7397da6e..60a1efc771 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml @@ -7,9 +7,12 @@ <public name="mapbox_AlertDialogStyle" type="style" /> + <!--DEPRECATED--> + <public name="mapbox_apiBaseUrl" type="attr" /> + <!-- Exposed attrs.xml --> <!--Configuration--> - <public name="mapbox_apiBaseUrl" type="attr" /> + <public name="mapbox_apiBaseUri" type="attr" /> <public name="mapbox_localIdeographFontFamily" type="attr" /> <public name="mapbox_cross_source_collisions" type="attr" /> <public name="mapbox_pixelRatio" type="float" /> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml index a7182d6e4b..3e7124a414 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml @@ -2,8 +2,11 @@ <!-- these are public --> <declare-styleable name="mapbox_MapView"> - <!--Configuration--> + <!--DEPRECATED use mapbox_apiBaseUri instead --> <attr name="mapbox_apiBaseUrl" format="string"/> + + <!--Configuration--> + <attr name="mapbox_apiBaseUri" format="string"/> <attr name="mapbox_localIdeographFontFamily" format="string"/> <attr name="mapbox_cross_source_collisions" format="boolean"/> diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleBuilderTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleBuilderTest.kt index ebab33347f..4c153414de 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleBuilderTest.kt +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleBuilderTest.kt @@ -23,7 +23,7 @@ class StyleBuilderTest { val expected = Style.MAPBOX_STREETS val builder = Style.Builder() builder.fromUrl(expected) - assertEquals(expected, builder.url) + assertEquals(expected, builder.uri) } @Test diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt index 1f5d7d8a32..ef30d46a7f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/StyleTest.kt @@ -37,7 +37,7 @@ class StyleTest { fun testFromUrl() { val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } } @Test @@ -119,7 +119,7 @@ class StyleTest { every { source.id } returns "1" val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS).withSource(source) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addSource(source) } } @@ -130,7 +130,7 @@ class StyleTest { every { layer.id } returns "1" val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS).withLayer(layer) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addLayerBelow(layer, MapboxConstants.LAYER_ID_ANNOTATIONS) } } @@ -141,7 +141,7 @@ class StyleTest { every { layer.id } returns "1" val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS).withLayerAt(layer, 1) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addLayerAt(layer, 1) } } @@ -152,7 +152,7 @@ class StyleTest { every { layer.id } returns "1" val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS).withLayerBelow(layer, "below") mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addLayerBelow(layer, "below") } } @@ -163,7 +163,7 @@ class StyleTest { every { layer.id } returns "1" val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS).withLayerBelow(layer, "below") mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addLayerBelow(layer, "below") } } @@ -173,7 +173,7 @@ class StyleTest { val transitionOptions = TransitionOptions(100, 200) val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS).withTransition(transitionOptions) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.transitionOptions = transitionOptions } } @@ -184,7 +184,7 @@ class StyleTest { every { callback.onStyleLoaded(any()) } answers {} val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS) mapboxMap.setStyle(builder, callback) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { callback.onStyleLoaded(any()) } } @@ -239,7 +239,7 @@ class StyleTest { every { source.id } returns "1" val builder = Style.Builder().fromUrl(Style.MAPBOX_STREETS).withSource(source) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.MAPBOX_STREETS } + verify(exactly = 1) { nativeMapView.styleUri = Style.MAPBOX_STREETS } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addSource(source) } verify(exactly = 1) { callback.onStyleLoaded(any()) } @@ -290,7 +290,7 @@ class StyleTest { val bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) val builder = Style.Builder().fromUrl(Style.SATELLITE).withImage("id", bitmap) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.SATELLITE } + verify(exactly = 1) { nativeMapView.styleUri = Style.SATELLITE } verify(exactly = 0) { nativeMapView.addImages(any()) } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addImages(any()) } @@ -303,7 +303,7 @@ class StyleTest { drawable.intrinsicWidth = 10 val builder = Style.Builder().fromUrl(Style.SATELLITE).withImage("id", drawable) mapboxMap.setStyle(builder) - verify(exactly = 1) { nativeMapView.styleUrl = Style.SATELLITE } + verify(exactly = 1) { nativeMapView.styleUri = Style.SATELLITE } verify(exactly = 0) { nativeMapView.addImages(any()) } mapboxMap.notifyStyleLoaded() verify(exactly = 1) { nativeMapView.addImages(any()) } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt index f16de23d69..a1fe6af659 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt @@ -52,8 +52,8 @@ class NativeMapViewTest { @UiThreadTest fun testSetStyleUrl() { val expected = Style.DARK - nativeMapView.styleUrl = expected - val actual = nativeMapView.styleUrl + nativeMapView.styleUri = expected + val actual = nativeMapView.styleUri assertEquals("Style URL should match", expected, actual) } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java index 97a73ba1cb..c168bf5f2e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java @@ -22,7 +22,7 @@ public class EspressoTest extends BaseTest { @UiThread @Override protected void initMap(MapboxMap mapboxMap) { - mapboxMap.setStyle(new Style.Builder().fromUrl("asset://streets.json")); + mapboxMap.setStyle(new Style.Builder().fromUri("asset://streets.json")); super.initMap(mapboxMap); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java index a4a34e752e..2d1fbf5fc4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java @@ -26,8 +26,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import timber.log.Timber; -import java.net.MalformedURLException; -import java.net.URL; import java.util.List; import static android.support.test.espresso.Espresso.onView; @@ -223,7 +221,7 @@ public class RuntimeStyleTests extends EspressoTest { invoke(mapboxMap, (uiController, mapboxMap) -> { VectorSource source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); mapboxMap.getStyle().addSource(source); - assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl()); + assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUri()); }); } @@ -233,23 +231,19 @@ public class RuntimeStyleTests extends EspressoTest { invoke(mapboxMap, (uiController, mapboxMap) -> { RasterSource source = new RasterSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); mapboxMap.getStyle().addSource(source); - assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl()); + assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUri()); }); } @Test - public void testGeoJsonSourceUrlGetter() throws MalformedURLException { + public void testGeoJsonSourceUrlGetter() { validateTestSetup(); invoke(mapboxMap, (uiController, mapboxMap) -> { GeoJsonSource source = new GeoJsonSource("my-source"); mapboxMap.getStyle().addSource(source); - assertNull(source.getUrl()); - try { - source.setUrl(new URL("http://mapbox.com/my-file.json")); - } catch (MalformedURLException exception) { - fail(); - } - assertEquals("http://mapbox.com/my-file.json", source.getUrl()); + assertNull(source.getUri()); + source.setUri("http://mapbox.com/my-file.json"); + assertEquals("http://mapbox.com/my-file.json", source.getUri()); }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java index fd666d9fd3..495b209831 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/StyleLoaderTest.java @@ -49,7 +49,7 @@ public class StyleLoaderTest extends EspressoTest { mapView.onResume(); String actual = mapboxMap.getStyle().getJson(); - assertEquals("Style URL should be empty", "", mapboxMap.getStyle().getUrl()); + assertEquals("Style URL should be empty", "", mapboxMap.getStyle().getUri()); assertEquals("Style json should match", expected, actual); } catch (IOException exception) { exception.printStackTrace(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java index 21693aaef9..54bf89ddef 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimationTypeActivity.java @@ -73,7 +73,7 @@ public class CameraAnimationTypeActivity extends AppCompatActivity implements On @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.MAPBOX_STREETS)); + mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS)); mapboxMap.getUiSettings().setAttributionEnabled(false); mapboxMap.getUiSettings().setLogoEnabled(false); mapboxMap.addOnCameraIdleListener(cameraIdleListener); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java index 23f887eb88..6d73ee776e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java @@ -69,7 +69,7 @@ public class LatLngBoundsActivity extends AppCompatActivity implements View.OnCl } private void loadStyle() { - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.MAPBOX_STREETS), style -> { + mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS), style -> { addMarkers(); initFab(); }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java index 837db7f7b5..d9b856d8ad 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ManualZoomActivity.java @@ -34,7 +34,7 @@ public class ManualZoomActivity extends AppCompatActivity { mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { ManualZoomActivity.this.mapboxMap = mapboxMap; - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.SATELLITE)); + mapboxMap.setStyle(new Style.Builder().fromUri(Style.SATELLITE)); UiSettings uiSettings = ManualZoomActivity.this.mapboxMap.getUiSettings(); uiSettings.setAllGesturesEnabled(false); }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java index f3bfe768be..6bc23df754 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java @@ -25,7 +25,7 @@ public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyC @Override public boolean onMapClick(@NonNull LatLng point) { if (mapboxMap != null) { - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.OUTDOORS)); + mapboxMap.setStyle(new Style.Builder().fromUri(Style.OUTDOORS)); } return true; } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java index 75cbf2ac0b..96038f3725 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java @@ -40,7 +40,7 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { mapView.getMapAsync(mapboxMap -> { QueryRenderedFeaturesBoxCountActivity.this.mapboxMap = mapboxMap; - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.MAPBOX_STREETS)); + mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS)); selectionBox.setOnClickListener(view -> { // Query diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java index 936850f2eb..4d13432792 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java @@ -75,7 +75,7 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity }); mapboxMap.setStyle(new Style.Builder() - .fromUrl(Style.MAPBOX_STREETS) + .fromUri(Style.MAPBOX_STREETS) .withSource(source) .withLayer(layer) ); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java index e444c2fcfd..a9c876c7cd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationMapChangeActivity.java @@ -36,7 +36,7 @@ public class LocationMapChangeActivity extends AppCompatActivity implements OnMa stylesFab.setOnClickListener(v -> { if (mapboxMap != null) { - mapboxMap.setStyle(new Style.Builder().fromUrl(Utils.getNextStyle())); + mapboxMap.setStyle(new Style.Builder().fromUri(Utils.getNextStyle())); } }); @@ -74,7 +74,7 @@ public class LocationMapChangeActivity extends AppCompatActivity implements OnMa @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; - mapboxMap.setStyle(new Style.Builder().fromUrl(Utils.getNextStyle()), + mapboxMap.setStyle(new Style.Builder().fromUri(Utils.getNextStyle()), style -> activateLocationComponent(style)); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java index 2366950834..f9adf608a1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationModesActivity.java @@ -233,8 +233,8 @@ public class LocationModesActivity extends AppCompatActivity implements OnMapRea return; } - String styleUrl = Style.DARK.equals(mapboxMap.getStyle().getUrl()) ? Style.LIGHT : Style.DARK; - mapboxMap.setStyle(new Style.Builder().fromUrl(styleUrl)); + String styleUrl = Style.DARK.equals(mapboxMap.getStyle().getUri()) ? Style.LIGHT : Style.DARK; + mapboxMap.setStyle(new Style.Builder().fromUri(styleUrl)); } private void disableGesturesManagement() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/ManualLocationUpdatesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/ManualLocationUpdatesActivity.java index 5ca00e5d0f..180fcfc832 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/ManualLocationUpdatesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/ManualLocationUpdatesActivity.java @@ -109,7 +109,7 @@ public class ManualLocationUpdatesActivity extends AppCompatActivity implements @SuppressLint("MissingPermission") @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.MAPBOX_STREETS), style -> { + mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS), style -> { locationComponent = mapboxMap.getLocationComponent(); locationComponent.activateLocationComponent( diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java index 9f96dcf1d1..4af6777995 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/BottomSheetActivity.java @@ -156,7 +156,7 @@ public class BottomSheetActivity extends AppCompatActivity { public void onMapReady(@NonNull MapboxMap mapboxMap) { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.760545, -122.436055), 15)); mapboxMap.setStyle( - new Style.Builder().fromUrl( + new Style.Builder().fromUri( STYLES[Math.min(Math.max(getArguments().getInt("mapcounter"), 0), STYLES.length - 1)] ) ); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java index d113393866..b34cdc6698 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java @@ -108,7 +108,7 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; mapboxMap.setStyle( - new Style.Builder().fromUrl(STYLES[currentStyleIndex]), style -> setupNavigationView(style.getLayers()) + new Style.Builder().fromUri(STYLES[currentStyleIndex]), style -> setupNavigationView(style.getLayers()) ); setupZoomView(); setFpsView(); @@ -173,7 +173,7 @@ public class DebugModeActivity extends AppCompatActivity implements OnMapReadyCa if (currentStyleIndex == STYLES.length) { currentStyleIndex = 0; } - mapboxMap.setStyle(new Style.Builder().fromUrl(STYLES[currentStyleIndex])); + mapboxMap.setStyle(new Style.Builder().fromUri(STYLES[currentStyleIndex])); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java index 46ef7ea467..a4ff5c71d6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java @@ -88,7 +88,7 @@ public class DoubleMapActivity extends AppCompatActivity { .build() ) ); - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.LIGHT)); + mapboxMap.setStyle(new Style.Builder().fromUri(Style.LIGHT)); UiSettings uiSettings = mapboxMap.getUiSettings(); uiSettings.setAllGesturesEnabled(false); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java index 66faf9b7a8..8406fe2332 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java @@ -22,7 +22,7 @@ public class SimpleMapActivity extends AppCompatActivity { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle( - new Style.Builder().fromUrl(Style.MAPBOX_STREETS) + new Style.Builder().fromUri(Style.MAPBOX_STREETS) )); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java index ccc50a13ad..ed3f91b85d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java @@ -80,7 +80,7 @@ public class OfflineActivity extends AppCompatActivity mapView.getMapAsync(mapboxMap -> { Timber.d("Map is ready"); OfflineActivity.this.mapboxMap = mapboxMap; - mapboxMap.setStyle(new Style.Builder().fromUrl(STYLE_URL)); + mapboxMap.setStyle(new Style.Builder().fromUri(STYLE_URL)); // Set initial position to UNHQ in NYC mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( new CameraPosition.Builder() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java index e474c46038..6c3993d4c6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/AnimatedImageSourceActivity.java @@ -57,7 +57,7 @@ public class AnimatedImageSourceActivity extends AppCompatActivity implements On final ImageSource imageSource = new ImageSource(ID_IMAGE_SOURCE, quad, R.drawable.southeast_radar_0); final RasterLayer layer = new RasterLayer(ID_IMAGE_LAYER, ID_IMAGE_SOURCE); map.setStyle(new Style.Builder() - .fromUrl(Style.MAPBOX_STREETS) + .fromUri(Style.MAPBOX_STREETS) .withSource(imageSource) .withLayer(layer), style -> { runnable = new RefreshImageRunnable(imageSource, handler); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java index 2805454a5c..076cd1d8e3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java @@ -213,7 +213,7 @@ public class CircleLayerActivity extends AppCompatActivity implements View.OnCli } private void loadNewStyle() { - mapboxMap.setStyle(new Style.Builder().fromUrl(getNextStyle())); + mapboxMap.setStyle(new Style.Builder().fromUri(getNextStyle())); } private void addBusStop() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java index 847a2b53c6..7f6fe4d0af 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionStyleTestActivity.java @@ -24,7 +24,7 @@ public class FillExtrusionStyleTestActivity extends AppCompatActivity { mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> - mapboxMap.setStyle(new Style.Builder().fromUrl(Style.MAPBOX_STREETS), + mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS), style -> FillExtrusionStyleTestActivity.this.mapboxMap = mapboxMap ) ); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java index 4e0052d90d..732a7929b8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java @@ -87,7 +87,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { try { mapboxMap.setStyle(new Style.Builder() - .fromUrl(Style.LIGHT) + .fromUri(Style.LIGHT) .withSource(clusterSource = createClusterSource()) .withLayer(createSymbolLayer()) .withLayer(createClusterLevelLayer(0, clusterLayers)) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java index 41e419c0bc..037437f5cc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java @@ -109,7 +109,7 @@ public class GridSourceActivity extends AppCompatActivity implements OnMapReadyC ); map.setStyle(new Style.Builder() - .fromUrl(Style.MAPBOX_STREETS) + .fromUri(Style.MAPBOX_STREETS) .withLayer(layer) .withSource(source) ); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HeatmapLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HeatmapLayerActivity.java index 5928896c9b..57d68f7f0c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HeatmapLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HeatmapLayerActivity.java @@ -59,7 +59,7 @@ public class HeatmapLayerActivity extends AppCompatActivity { try { mapboxMap.setStyle(new Style.Builder() - .fromUrl(Style.DARK) + .fromUri(Style.DARK) .withSource(createEarthquakeSource()) .withLayerAbove(createHeatmapLayer(), "waterway-label") .withLayerBelow(createCircleLayer(), HEATMAP_LAYER_ID) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java index b65248ceae..0ed3a5d130 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/HillshadeLayerActivity.java @@ -36,7 +36,7 @@ public class HillshadeLayerActivity extends AppCompatActivity { RasterDemSource rasterDemSource = new RasterDemSource(SOURCE_ID, SOURCE_URL); HillshadeLayer hillshadeLayer = new HillshadeLayer(LAYER_ID, SOURCE_ID); mapboxMap.setStyle(new Style.Builder() - .fromUrl(Style.MAPBOX_STREETS) + .fromUri(Style.MAPBOX_STREETS) .withLayerBelow(hillshadeLayer, LAYER_BELOW_ID) .withSource(rasterDemSource) ); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java index 552cb8e41c..09bb00b84d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java @@ -94,7 +94,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { mapboxMap.setStyle( new Style.Builder() - .fromUrl(Style.MAPBOX_STREETS) + .fromUri(Style.MAPBOX_STREETS) // set custom transition .withTransition(new TransitionOptions(250, 50)), style -> styleLoaded = true ); @@ -497,7 +497,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void styleFillFilterLayer() { - mapboxMap.setStyle(new Style.Builder().fromUrl("asset://fill_filter_style.json")); + mapboxMap.setStyle(new Style.Builder().fromUri("asset://fill_filter_style.json")); mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(31, -100), 3)); Handler handler = new Handler(getMainLooper()); @@ -525,7 +525,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void styleLineFilterLayer() { - mapboxMap.setStyle(new Style.Builder().fromUrl("asset://line_filter_style.json")); + mapboxMap.setStyle(new Style.Builder().fromUri("asset://line_filter_style.json")); mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40, -97), 5)); Handler handler = new Handler(getMainLooper()); @@ -553,7 +553,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void styleNumericFillLayer() { - mapboxMap.setStyle(new Style.Builder().fromUrl("asset://numeric_filter_style.json")); + mapboxMap.setStyle(new Style.Builder().fromUri("asset://numeric_filter_style.json")); mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40, -97), 5)); Handler handler = new Handler(getMainLooper()); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java index 6fd92e2e5c..375e236669 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java @@ -45,7 +45,7 @@ public class RuntimeStyleTimingTestActivity extends AppCompatActivity { VectorSource museums = new VectorSource("museums_source", "mapbox://mapbox.2opop9hr"); mapboxMap.setStyle(new Style.Builder() - .fromUrl(Style.MAPBOX_STREETS) + .fromUri(Style.MAPBOX_STREETS) .withSource(museums) .withLayer(museumsLayer)); }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java index d5b115380e..5e3ed12489 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java @@ -116,7 +116,7 @@ public class StyleFileActivity extends AppCompatActivity { // Actual file:// usage MapboxMap mapboxMap = this.mapboxMap.get(); if (mapboxMap != null) { - mapboxMap.setStyle(new Style.Builder().fromUrl("file://" + cacheStyleFile.getAbsolutePath())); + mapboxMap.setStyle(new Style.Builder().fromUri("file://" + cacheStyleFile.getAbsolutePath())); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java index a39fc020bf..243fa67ec4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java @@ -175,7 +175,7 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap. shuffleMapboxSign(); mapboxMap.setStyle(new Style.Builder() - .fromUrl("asset://streets.json") + .fromUri("asset://streets.json") .withImage("Car", Objects.requireNonNull(carBitmap), false) .withSources(markerSource, mapboxSignSource) .withLayers(markerSymbolLayer, mapboxSignSymbolLayer) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/telemetry/PerformanceMeasurementActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/telemetry/PerformanceMeasurementActivity.java index 62d061cab4..f15e1baa67 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/telemetry/PerformanceMeasurementActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/telemetry/PerformanceMeasurementActivity.java @@ -48,7 +48,7 @@ public class PerformanceMeasurementActivity extends AppCompatActivity { HttpRequestUtil.setOkHttpClient(okHttpClient); mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle( - new Style.Builder().fromUrl(Style.MAPBOX_STREETS))); + new Style.Builder().fromUri(Style.MAPBOX_STREETS))); } |