diff options
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 | 52 |
1 files changed, 41 insertions, 11 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 0075199b1e..f48bd92327 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 @@ -77,7 +77,8 @@ public class MapboxMapOptions implements Parcelable { @ColorInt private int foregroundLoadColor; - private String style; + private String styleUrl; + private String styleJson; private float pixelRatio; @@ -120,7 +121,8 @@ public class MapboxMapOptions implements Parcelable { zoomGesturesEnabled = in.readByte() != 0; doubleTapGesturesEnabled = in.readByte() != 0; - style = in.readString(); + styleUrl = in.readString(); + styleJson = in.readString(); apiBaseUrl = in.readString(); textureMode = in.readByte() != 0; translucentTextureSurface = in.readByte() != 0; @@ -145,6 +147,7 @@ public class MapboxMapOptions implements Parcelable { try { mapboxMapOptions.camera(new CameraPosition.Builder(typedArray).build()); mapboxMapOptions.styleUrl(typedArray.getString(R.styleable.mapbox_MapView_mapbox_styleUrl)); + mapboxMapOptions.styleJson(typedArray.getString(R.styleable.mapbox_MapView_mapbox_styleJson)); mapboxMapOptions.apiBaseUrl(typedArray.getString(R.styleable.mapbox_MapView_mapbox_apiBaseUrl)); mapboxMapOptions.zoomGesturesEnabled( @@ -258,13 +261,24 @@ public class MapboxMapOptions implements Parcelable { } /** - * Specifies the style url associated with a map view. + * Specifies the styleUrl url associated with a map view. * - * @param styleUrl Url to be used to load a style + * @param styleUrl Url to be used to load a styleUrl * @return This */ public MapboxMapOptions styleUrl(String styleUrl) { - style = styleUrl; + this.styleUrl = styleUrl; + return this; + } + + /** + * Specifies the styleJson associated with a map view. + * + * @param styleJson json to used as style + * @return This + */ + public MapboxMapOptions styleJson(String styleJson) { + this.styleJson = styleJson; return this; } @@ -716,12 +730,21 @@ public class MapboxMapOptions implements Parcelable { } /** - * Get the current configured style url for a map view. + * Get the current configured styleUrl url for a map view. * * @return Style url to be used. */ - public String getStyle() { - return style; + public String getStyleUrl() { + return styleUrl; + } + + /** + * Get the current configured styleJson for a map view. + * + * @return Style json to be used. + */ + public String getStyleJson() { + return styleJson; } /** @@ -912,7 +935,8 @@ public class MapboxMapOptions implements Parcelable { dest.writeByte((byte) (zoomGesturesEnabled ? 1 : 0)); dest.writeByte((byte) (doubleTapGesturesEnabled ? 1 : 0)); - dest.writeString(style); + dest.writeString(styleUrl); + dest.writeString(styleJson); dest.writeString(apiBaseUrl); dest.writeByte((byte) (textureMode ? 1 : 0)); dest.writeByte((byte) (translucentTextureSurface ? 1 : 0)); @@ -1002,9 +1026,14 @@ public class MapboxMapOptions implements Parcelable { if (!Arrays.equals(attributionMargins, options.attributionMargins)) { return false; } - if (style != null ? !style.equals(options.style) : options.style != null) { + if (styleUrl != null ? !styleUrl.equals(options.styleUrl) : options.styleUrl != null) { return false; } + + if (styleJson != null ? !styleJson.equals(options.styleJson) : options.styleJson != null) { + return false; + } + if (apiBaseUrl != null ? !apiBaseUrl.equals(options.apiBaseUrl) : options.apiBaseUrl != null) { return false; } @@ -1055,7 +1084,8 @@ public class MapboxMapOptions implements Parcelable { result = 31 * result + (apiBaseUrl != null ? apiBaseUrl.hashCode() : 0); result = 31 * result + (textureMode ? 1 : 0); result = 31 * result + (translucentTextureSurface ? 1 : 0); - result = 31 * result + (style != null ? style.hashCode() : 0); + result = 31 * result + (styleUrl != null ? styleUrl.hashCode() : 0); + result = 31 * result + (styleJson != null ? styleJson.hashCode() : 0); result = 31 * result + (prefetchesTiles ? 1 : 0); result = 31 * result + (zMediaOverlay ? 1 : 0); result = 31 * result + (localIdeographFontFamily != null ? localIdeographFontFamily.hashCode() : 0); |