summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java87
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java50
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java106
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java2
5 files changed, 111 insertions, 136 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java
deleted file mode 100644
index 9943a72e06..0000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.mapbox.mapboxsdk.constants;
-
-import android.support.annotation.StringDef;
-
-import com.mapbox.mapboxsdk.maps.MapView;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * <p>
- * Style provides URLs to several professional styles designed by Mapbox.
- * </p>
- * These styles are all ready to go in your app. To load one, pass it into {@link MapView#setStyleUrl(String)}
- *
- * @see MapView#setStyleUrl(String)
- */
-public class Style {
-
- /**
- * Indicates the parameter accepts one of the values from Style. Using one of these
- * constants means your map style will always use the latest version and may change as we
- * improve the style
- */
- @StringDef( {MAPBOX_STREETS, OUTDOORS, LIGHT, DARK, SATELLITE, SATELLITE_STREETS, TRAFFIC_DAY, TRAFFIC_NIGHT})
- @Retention(RetentionPolicy.SOURCE)
- public @interface StyleUrl {
- }
-
- // IMPORTANT: If you change any of these you also need to edit them in strings.xml
-
- /**
- * Mapbox Streets: A complete basemap, perfect for incorporating your own data. Using this
- * constant means your map style will always use the latest version and may change as we
- * improve the style.
- */
- public static final String MAPBOX_STREETS = "mapbox://styles/mapbox/streets-v10";
-
- /**
- * Outdoors: A general-purpose style tailored to outdoor activities. Using this constant means
- * your map style will always use the latest version and may change as we improve the style.
- */
- public static final String OUTDOORS = "mapbox://styles/mapbox/outdoors-v10";
-
- /**
- * Light: Subtle light backdrop for data visualizations. Using this constant means your map
- * style will always use the latest version and may change as we improve the style.
- */
- public static final String LIGHT = "mapbox://styles/mapbox/light-v9";
-
- /**
- * Dark: Subtle dark backdrop for data visualizations. Using this constant means your map style
- * will always use the latest version and may change as we improve the style.
- */
- public static final String DARK = "mapbox://styles/mapbox/dark-v9";
-
- /**
- * Satellite: A beautiful global satellite and aerial imagery layer. Using this constant means
- * your map style will always use the latest version and may change as we improve the style.
- */
- public static final String SATELLITE = "mapbox://styles/mapbox/satellite-v9";
-
- /**
- * Satellite Streets: Global satellite and aerial imagery with unobtrusive labels. Using this
- * constant means your map style will always use the latest version and may change as we
- * improve the style.
- */
- public static final String SATELLITE_STREETS = "mapbox://styles/mapbox/satellite-streets-v10";
-
- /**
- * Traffic Day: Color-coded roads based on live traffic congestion data. Traffic data is currently
- * available in
- * <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select
- * countries</a>. Using this constant means your map style will always use the latest version and
- * may change as we improve the style.
- */
- public static final String TRAFFIC_DAY = "mapbox://styles/mapbox/traffic-day-v2";
-
- /**
- * Traffic Night: Color-coded roads based on live traffic congestion data, designed to maximize
- * legibility in low-light situations. Traffic data is currently available in
- * <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select
- * countries</a>. Using this constant means your map style will always use the latest version and
- * may change as we improve the style.
- */
- public static final String TRAFFIC_NIGHT = "mapbox://styles/mapbox/traffic-night-v2";
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index fc9418c2d9..29235b899f 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -28,7 +28,7 @@ import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.constants.Style;
+import com.mapbox.mapboxsdk.maps.Style;
import com.mapbox.mapboxsdk.location.LocationComponent;
import com.mapbox.mapboxsdk.maps.renderer.MapRenderer;
import com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer;
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 9c36343051..d9ee460ec1 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
@@ -34,7 +34,7 @@ import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.constants.Style;
+import com.mapbox.mapboxsdk.maps.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.location.LocationComponent;
@@ -76,13 +76,13 @@ public final class MapboxMap {
@Nullable
private MapboxMap.OnFpsChangedListener onFpsChangedListener;
- private com.mapbox.mapboxsdk.maps.Style style;
+ private Style style;
MapboxMap(NativeMapView map, Transform transform, UiSettings ui, Projection projection,
OnGesturesManagerInteractionListener listener, AnnotationManager annotations,
CameraChangeDispatcher cameraChangeDispatcher, MapChangeReceiver mapChangeReceiver) {
this.nativeMapView = map;
- this.style = new com.mapbox.mapboxsdk.maps.Style(nativeMapView);
+ this.style = new Style(nativeMapView);
this.uiSettings = ui;
this.projection = projection;
this.annotationManager = annotations.bind(this);
@@ -104,7 +104,7 @@ public final class MapboxMap {
setPrefetchesTiles(options);
}
- public com.mapbox.mapboxsdk.maps.Style getStyle(){
+ public Style getStyle(){
return style;
}
@@ -213,48 +213,6 @@ public final class MapboxMap {
// Style
/**
- * <p>
- * Get the animation duration for style changes.
- * </p>
- * The default value is zero, so any changes take effect without animation.
- *
- * @return Duration in milliseconds
- */
- public long getTransitionDuration() {
- return nativeMapView.getTransitionDuration();
- }
-
- /**
- * Set the animation duration for style changes.
- *
- * @param durationMs Duration in milliseconds
- */
- public void setTransitionDuration(long durationMs) {
- nativeMapView.setTransitionDuration(durationMs);
- }
-
- /**
- * <p>
- * Get the animation delay for style changes.
- * </p>
- * The default value is zero, so any changes begin to animate immediately.
- *
- * @return Delay in milliseconds
- */
- public long getTransitionDelay() {
- return nativeMapView.getTransitionDelay();
- }
-
- /**
- * Set the animation delay for style changes.
- *
- * @param delayMs Delay in milliseconds
- */
- public void setTransitionDelay(long delayMs) {
- nativeMapView.setTransitionDelay(delayMs);
- }
-
- /**
* Sets tile pre-fetching from MapboxOptions.
*
* @param options the options object
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 50192d8f8d..8a8a351db3 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
@@ -1,8 +1,12 @@
package com.mapbox.mapboxsdk.maps;
+import android.support.annotation.StringDef;
import com.mapbox.mapboxsdk.style.layers.Layer;
+import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
import com.mapbox.mapboxsdk.style.sources.Source;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.HashMap;
public class Style {
@@ -15,7 +19,7 @@ public class Style {
this.nativeMapView = nativeMapView;
}
- public void loadStyle(@com.mapbox.mapboxsdk.constants.Style.StyleUrl String styleUrl) {
+ public void loadStyle(@StyleUrl String styleUrl) {
for (Source source : sources.values()) {
if (source != null) {
source.setDetached();
@@ -67,5 +71,105 @@ public class Style {
return layer;
}
+ //
+ // Transition
+ //
+
+
+ /**
+ * <p>
+ * Set the transition duration for style changes.
+ * </p>
+ * The default value for delay and duration is zero, so any changes take effect without animation.
+ *
+ * @param transitionOptions the transition options
+ */
+ public void setTransition(TransitionOptions transitionOptions) {
+ nativeMapView.setTransitionDuration(transitionOptions.getDuration());
+ nativeMapView.setTransitionDelay(transitionOptions.getDelay());
+ }
+
+ /**
+ * <p>
+ * Get the transition for style changes.
+ * </p>
+ * The default value for delay and transition is zero, so any changes take effect without animation.
+ *
+ * @return TransitionOptions the transition options
+ */
+ public TransitionOptions getTransition() {
+ return new TransitionOptions(nativeMapView.getTransitionDuration(), nativeMapView.getTransitionDelay());
+ }
+
+ //
+ // Style constants
+ //
+
+ /**
+ * Indicates the parameter accepts one of the values from Style. Using one of these
+ * constants means your map style will always use the latest version and may change as we
+ * improve the style
+ */
+ @StringDef( {MAPBOX_STREETS, OUTDOORS, LIGHT, DARK, SATELLITE, SATELLITE_STREETS, TRAFFIC_DAY, TRAFFIC_NIGHT})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface StyleUrl {
+ }
+ // IMPORTANT: If you change any of these you also need to edit them in strings.xml
+
+ /**
+ * Mapbox Streets: A complete basemap, perfect for incorporating your own data. Using this
+ * constant means your map style will always use the latest version and may change as we
+ * improve the style.
+ */
+ public static final String MAPBOX_STREETS = "mapbox://styles/mapbox/streets-v10";
+
+ /**
+ * Outdoors: A general-purpose style tailored to outdoor activities. Using this constant means
+ * your map style will always use the latest version and may change as we improve the style.
+ */
+ public static final String OUTDOORS = "mapbox://styles/mapbox/outdoors-v10";
+
+ /**
+ * Light: Subtle light backdrop for data visualizations. Using this constant means your map
+ * style will always use the latest version and may change as we improve the style.
+ */
+ public static final String LIGHT = "mapbox://styles/mapbox/light-v9";
+
+ /**
+ * Dark: Subtle dark backdrop for data visualizations. Using this constant means your map style
+ * will always use the latest version and may change as we improve the style.
+ */
+ public static final String DARK = "mapbox://styles/mapbox/dark-v9";
+
+ /**
+ * Satellite: A beautiful global satellite and aerial imagery layer. Using this constant means
+ * your map style will always use the latest version and may change as we improve the style.
+ */
+ public static final String SATELLITE = "mapbox://styles/mapbox/satellite-v9";
+
+ /**
+ * Satellite Streets: Global satellite and aerial imagery with unobtrusive labels. Using this
+ * constant means your map style will always use the latest version and may change as we
+ * improve the style.
+ */
+ public static final String SATELLITE_STREETS = "mapbox://styles/mapbox/satellite-streets-v10";
+
+ /**
+ * Traffic Day: Color-coded roads based on live traffic congestion data. Traffic data is currently
+ * available in
+ * <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select
+ * countries</a>. Using this constant means your map style will always use the latest version and
+ * may change as we improve the style.
+ */
+ public static final String TRAFFIC_DAY = "mapbox://styles/mapbox/traffic-day-v2";
+
+ /**
+ * Traffic Night: Color-coded roads based on live traffic congestion data, designed to maximize
+ * legibility in low-light situations. Traffic data is currently available in
+ * <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select
+ * countries</a>. Using this constant means your map style will always use the latest version and
+ * may change as we improve the style.
+ */
+ public static final String TRAFFIC_NIGHT = "mapbox://styles/mapbox/traffic-night-v2";
}
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 cd8cf6a85a..a1d84f1fd4 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
@@ -25,7 +25,7 @@ import com.mapbox.mapboxsdk.attribution.AttributionLayout;
import com.mapbox.mapboxsdk.attribution.AttributionMeasure;
import com.mapbox.mapboxsdk.attribution.AttributionParser;
import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.constants.Style;
+import com.mapbox.mapboxsdk.maps.Style;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.log.Logger;
import com.mapbox.mapboxsdk.maps.TelemetryDefinition;