summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java7
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java57
2 files changed, 63 insertions, 1 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 6d68302c61..2211d4bd1d 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
@@ -95,7 +95,7 @@ public final class MapboxMap {
setPrefetchesTiles(options);
}
- public Style getStyle(){
+ public Style getStyle() {
return style;
}
@@ -679,6 +679,11 @@ public final class MapboxMap {
// Styling
//
+ public void setStyle(Style.Builder builder) {
+
+ }
+
+
/**
* <p>
* Loads a new map style asynchronous from the specified URL.
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 9e8748ce4b..9cc14d67db 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
@@ -12,6 +12,7 @@ import com.mapbox.mapboxsdk.style.sources.Source;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -326,6 +327,62 @@ public class Style {
}
//
+ // Builder
+ //
+
+ public static class Builder {
+
+ private String styleUrl;
+ private String styleJson;
+ private List<Source> sources = new ArrayList<>();
+ // TODO allow adding below and at index
+ private List<Layer> layers = new ArrayList<>();
+ private TransitionOptions transitionOptions;
+
+ public Builder withStyleUrl(@StyleUrl String styleUrl) {
+ this.styleUrl = styleUrl;
+ return this;
+ }
+
+ public Builder withStyleJson(String styleJson) {
+ this.styleJson = styleJson;
+ return this;
+ }
+
+ public Builder withSource(Source source) {
+ sources.add(source);
+ return this;
+ }
+
+ public Builder withLayer(Layer layer) {
+ layers.add(layer);
+ return this;
+ }
+
+ public Builder withTransition(TransitionOptions transition) {
+ this.transitionOptions = transition;
+ return this;
+ }
+
+ Style build(NativeMapView nativeMapView) {
+ Style style = new Style(nativeMapView);
+ for (Source source : sources) {
+ style.addSource(source);
+ }
+
+ for (Layer layer : layers) {
+ style.addLayer(layer);
+ }
+
+ if (transitionOptions != null) {
+ style.setTransition(transitionOptions);
+ }
+ return style;
+ }
+
+ }
+
+ //
// Style URL constants
//