summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java9
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySourceOptions.java8
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java10
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java8
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java5
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java5
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java2
10 files changed, 46 insertions, 9 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java
index 4129f2b2b4..b75ccf5a9c 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java
@@ -129,6 +129,7 @@ public class CustomGeometrySource extends Source {
@Keep
protected native void initialize(String sourceId, Object options);
+ @NonNull
@Keep
private native Feature[] querySourceFeatures(Object[] filter);
@@ -179,7 +180,7 @@ public class CustomGeometrySource extends Source {
}
}
- private void executeRequest(GeometryTileRequest request) {
+ private void executeRequest(@NonNull GeometryTileRequest request) {
executorLock.lock();
try {
if (executor != null && !executor.isShutdown()) {
@@ -235,6 +236,7 @@ public class CustomGeometrySource extends Source {
final AtomicInteger threadCount = new AtomicInteger();
final int poolId = poolCount.getAndIncrement();
+ @NonNull
@Override
public Thread newThread(@NonNull Runnable runnable) {
return new Thread(
@@ -277,7 +279,7 @@ public class CustomGeometrySource extends Source {
return Arrays.hashCode(new int[] {z, x, y});
}
- public boolean equals(Object object) {
+ public boolean equals(@Nullable Object object) {
if (object == this) {
return true;
}
@@ -299,6 +301,7 @@ public class CustomGeometrySource extends Source {
private final GeometryTileProvider provider;
private final Map<TileID, GeometryTileRequest> awaiting;
private final Map<TileID, AtomicBoolean> inProgress;
+ @NonNull
private final WeakReference<CustomGeometrySource> sourceRef;
private final AtomicBoolean cancelled;
@@ -362,7 +365,7 @@ public class CustomGeometrySource extends Source {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySourceOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySourceOptions.java
index 331d9b267f..b5a5d6aade 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySourceOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySourceOptions.java
@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.style.sources;
+import android.support.annotation.NonNull;
+
import java.util.HashMap;
/**
@@ -13,6 +15,7 @@ public class CustomGeometrySourceOptions extends HashMap<String, Object> {
* @param wrap defaults to false
* @return the current instance for chaining
*/
+ @NonNull
public CustomGeometrySourceOptions withWrap(boolean wrap) {
this.put("wrap", wrap);
return this;
@@ -25,6 +28,7 @@ public class CustomGeometrySourceOptions extends HashMap<String, Object> {
* @param clip defaults to false
* @return the current instance for chaining
*/
+ @NonNull
public CustomGeometrySourceOptions withClip(boolean clip) {
this.put("clip", clip);
return this;
@@ -36,6 +40,7 @@ public class CustomGeometrySourceOptions extends HashMap<String, Object> {
* @param minZoom the minimum zoom - Defaults to 0.
* @return the current instance for chaining
*/
+ @NonNull
public CustomGeometrySourceOptions withMinZoom(int minZoom) {
this.put("minzoom", minZoom);
return this;
@@ -47,6 +52,7 @@ public class CustomGeometrySourceOptions extends HashMap<String, Object> {
* @param maxZoom the maximum zoom - Defaults to 25.5
* @return the current instance for chaining
*/
+ @NonNull
public CustomGeometrySourceOptions withMaxZoom(int maxZoom) {
this.put("maxzoom", maxZoom);
return this;
@@ -59,6 +65,7 @@ public class CustomGeometrySourceOptions extends HashMap<String, Object> {
* @param buffer the buffer size - Defaults to 128.
* @return the current instance for chaining
*/
+ @NonNull
public CustomGeometrySourceOptions withBuffer(int buffer) {
this.put("buffer", buffer);
return this;
@@ -70,6 +77,7 @@ public class CustomGeometrySourceOptions extends HashMap<String, Object> {
* @param tolerance the tolerance - Defaults to 0.375
* @return the current instance for chaining
*/
+ @NonNull
public CustomGeometrySourceOptions withTolerance(float tolerance) {
this.put("tolerance", tolerance);
return this;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java
index 00715bc213..1e1b9bafa6 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java
@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.style.sources;
+import android.support.annotation.NonNull;
+
import java.util.HashMap;
/**
@@ -16,6 +18,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* @param minZoom the minimum zoom - Defaults to 0.
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withMinZoom(int minZoom) {
this.put("minzoom", minZoom);
return this;
@@ -27,6 +30,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* @param maxZoom the maximum zoom - Defaults to 25.5
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withMaxZoom(int maxZoom) {
this.put("maxzoom", maxZoom);
return this;
@@ -39,6 +43,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* @param buffer the buffer size - Defaults to 128.
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withBuffer(int buffer) {
this.put("buffer", buffer);
return this;
@@ -50,6 +55,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* @param lineMetrics true to calculate line distance metrics.
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withLineMetrics(boolean lineMetrics) {
this.put("lineMetrics", lineMetrics);
return this;
@@ -61,6 +67,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* @param tolerance the tolerance - Defaults to 0.375
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withTolerance(float tolerance) {
this.put("tolerance", tolerance);
return this;
@@ -72,6 +79,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* @param cluster cluster? - Defaults to false
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withCluster(boolean cluster) {
this.put("cluster", cluster);
return this;
@@ -84,6 +92,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* zoom features are not clustered)
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withClusterMaxZoom(int clusterMaxZoom) {
this.put("clusterMaxZoom", clusterMaxZoom);
return this;
@@ -95,6 +104,7 @@ public class GeoJsonOptions extends HashMap<String, Object> {
* @param clusterRadius cluster radius - Defaults to 50
* @return the current instance for chaining
*/
+ @NonNull
public GeoJsonOptions withClusterRadius(int clusterRadius) {
this.put("clusterRadius", clusterRadius);
return this;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
index 2d9b1c985a..a9eb43f968 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
@@ -62,7 +62,7 @@ public class GeoJsonSource extends Source {
* @param id the source id
* @param geoJson raw Json FeatureCollection
*/
- public GeoJsonSource(String id, String geoJson) {
+ public GeoJsonSource(String id, @Nullable String geoJson) {
super();
if (geoJson == null || geoJson.startsWith("http")) {
throw new IllegalArgumentException("Expected a raw json body");
@@ -78,7 +78,7 @@ public class GeoJsonSource extends Source {
* @param geoJson raw Json body
* @param options options
*/
- public GeoJsonSource(String id, String geoJson, GeoJsonOptions options) {
+ public GeoJsonSource(String id, @Nullable String geoJson, GeoJsonOptions options) {
super();
if (geoJson == null || geoJson.startsWith("http")) {
throw new IllegalArgumentException("Expected a raw json body");
@@ -236,7 +236,7 @@ public class GeoJsonSource extends Source {
*
* @param url the GeoJSON FeatureCollection url
*/
- public void setUrl(URL url) {
+ public void setUrl(@NonNull URL url) {
checkThread();
setUrl(url.toExternalForm());
}
@@ -279,6 +279,7 @@ public class GeoJsonSource extends Source {
@Keep
protected native void nativeSetUrl(String url);
+ @NonNull
@Keep
protected native String nativeGetUrl();
@@ -294,6 +295,7 @@ public class GeoJsonSource extends Source {
@Keep
private native void nativeSetGeometry(Geometry geometry);
+ @NonNull
@Keep
private native Feature[] querySourceFeatures(Object[] filter);
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java
index d0ca5e050b..2579c95870 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java
@@ -46,7 +46,7 @@ public class ImageSource extends Source {
* @param coordinates The Latitude and Longitude of the four corners of the image
* @param url remote json file
*/
- public ImageSource(String id, LatLngQuad coordinates, URL url) {
+ public ImageSource(String id, LatLngQuad coordinates, @NonNull URL url) {
super();
initialize(id, coordinates);
setUrl(url);
@@ -83,7 +83,7 @@ public class ImageSource extends Source {
*
* @param url An Image url
*/
- public void setUrl(URL url) {
+ public void setUrl(@NonNull URL url) {
setUrl(url.toExternalForm());
}
@@ -149,6 +149,7 @@ public class ImageSource extends Source {
@Keep
protected native void nativeSetUrl(String url);
+ @NonNull
@Keep
protected native String nativeGetUrl();
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java
index 4c2b39375a..6bc6d40287 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java
@@ -1,6 +1,7 @@
package com.mapbox.mapboxsdk.style.sources;
import android.support.annotation.Keep;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
@@ -97,6 +98,7 @@ public class RasterDemSource extends Source {
@Keep
protected native void finalize() throws Throwable;
+ @NonNull
@Keep
protected native String nativeGetUrl();
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java
index dac9b02166..1390a1c055 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java
@@ -1,6 +1,7 @@
package com.mapbox.mapboxsdk.style.sources;
import android.support.annotation.Keep;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.net.URL;
@@ -96,6 +97,7 @@ public class RasterSource extends Source {
@Keep
protected native void finalize() throws Throwable;
+ @NonNull
@Keep
protected native String nativeGetUrl();
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java
index 14d9ef1cc5..44f4a6c344 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.style.sources;
import android.support.annotation.Keep;
+import android.support.annotation.NonNull;
import com.mapbox.mapboxsdk.utils.ThreadUtils;
/**
@@ -39,6 +40,7 @@ public abstract class Source {
*
* @return the source id
*/
+ @NonNull
public String getId() {
checkThread();
return nativeGetId();
@@ -52,6 +54,7 @@ public abstract class Source {
*
* @return the string representation of the attribution in html format
*/
+ @NonNull
public String getAttribution() {
checkThread();
return nativeGetAttribution();
@@ -66,9 +69,11 @@ public abstract class Source {
return nativePtr;
}
+ @NonNull
@Keep
protected native String nativeGetId();
+ @NonNull
@Keep
protected native String nativeGetAttribution();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java
index 25df2d91e7..1e4be24189 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java
@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.style.sources;
+import android.support.annotation.NonNull;
import android.support.annotation.Size;
import com.mapbox.mapboxsdk.geometry.LatLng;
@@ -281,10 +282,11 @@ public class TileSet {
this.center = center;
}
- public void setCenter(LatLng center) {
+ public void setCenter(@NonNull LatLng center) {
this.center = new Float[] {(float) center.getLongitude(), (float) center.getLatitude()};
}
+ @NonNull
Map<String, Object> toValueObject() {
Map<String, Object> result = new HashMap<>();
result.put("tilejson", tilejson);
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java
index 5888eaa7e1..7028530f1f 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java
@@ -97,9 +97,11 @@ public class VectorSource extends Source {
@Keep
protected native void finalize() throws Throwable;
+ @NonNull
@Keep
protected native String nativeGetUrl();
+ @NonNull
@Keep
private native Feature[] querySourceFeatures(String[] sourceLayerId,
Object[] filter);