[android] - use builder json/url for constructing style object
This commit is contained in:
@@ -759,10 +759,10 @@ public final class MapboxMap {
|
||||
}
|
||||
|
||||
style = builder.build(nativeMapView);
|
||||
if (!TextUtils.isEmpty(style.getUrl())) {
|
||||
nativeMapView.setStyleUrl(style.getUrl());
|
||||
} else if (!TextUtils.isEmpty(style.getJson())) {
|
||||
nativeMapView.setStyleJson(style.getJson());
|
||||
if (!TextUtils.isEmpty(builder.getUrl())) {
|
||||
nativeMapView.setStyleUrl(builder.getUrl());
|
||||
} else if (!TextUtils.isEmpty(builder.getJson())) {
|
||||
nativeMapView.setStyleJson(builder.getJson());
|
||||
} else {
|
||||
// user didn't provide a `from` component,
|
||||
// flag the style as loaded,
|
||||
|
||||
@@ -34,8 +34,6 @@ public class Style {
|
||||
private final HashMap<String, Layer> layers = new HashMap<>();
|
||||
private final HashMap<String, Bitmap> images = new HashMap<>();
|
||||
private final Builder builder;
|
||||
private String styleUrl;
|
||||
private String styleJson;
|
||||
private boolean styleLoaded;
|
||||
|
||||
/**
|
||||
@@ -46,8 +44,6 @@ public class Style {
|
||||
*/
|
||||
private Style(@NonNull Builder builder, @NonNull NativeMapView nativeMapView) {
|
||||
this.builder = builder;
|
||||
styleUrl = builder.styleUrl;
|
||||
styleJson = builder.styleJson;
|
||||
this.nativeMapView = nativeMapView;
|
||||
}
|
||||
|
||||
@@ -56,9 +52,9 @@ public class Style {
|
||||
*
|
||||
* @return the style url
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
public String getUrl() {
|
||||
return styleUrl;
|
||||
return nativeMapView.getStyleUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,9 +62,9 @@ public class Style {
|
||||
*
|
||||
* @return the style json
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
public String getJson() {
|
||||
return styleJson;
|
||||
return nativeMapView.getStyleJson();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -599,6 +595,14 @@ public class Style {
|
||||
return this;
|
||||
}
|
||||
|
||||
String getUrl() {
|
||||
return styleUrl;
|
||||
}
|
||||
|
||||
String getJson() {
|
||||
return styleJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the composed style.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user