summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java')
-rwxr-xr-xplatform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java53
1 files changed, 24 insertions, 29 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
index 532f311e90..035aa0361b 100755
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
@@ -748,29 +748,32 @@ final class NativeMapView {
nativeAddLayerAt(layer.getNativePtr(), index);
}
- @Nullable
- public Layer removeLayer(@NonNull String layerId) {
+ public boolean removeLayer(@NonNull String layerId) {
if (checkState("removeLayer")) {
- return null;
+ return false;
}
- return nativeRemoveLayerById(layerId);
+
+ Layer layer = getLayer(layerId);
+ if (layer != null) {
+ return removeLayer(layer);
+ }
+ return false;
}
- @Nullable
- public Layer removeLayer(@NonNull Layer layer) {
+
+ public boolean removeLayer(@NonNull Layer layer) {
if (checkState("removeLayer")) {
- return null;
+ return false;
}
- nativeRemoveLayer(layer.getNativePtr());
- return layer;
+ return nativeRemoveLayer(layer.getNativePtr());
}
- @Nullable
- public Layer removeLayerAt(@IntRange(from = 0) int index) {
+ public boolean removeLayerAt(@IntRange(from = 0) int index) {
if (checkState("removeLayerAt")) {
- return null;
+ return false;
}
return nativeRemoveLayerAt(index);
+
}
public List<Source> getSources() {
@@ -794,25 +797,22 @@ final class NativeMapView {
nativeAddSource(source, source.getNativePtr());
}
- @Nullable
- public Source removeSource(@NonNull String sourceId) {
+ public boolean removeSource(@NonNull String sourceId) {
if (checkState("removeSource")) {
- return null;
+ return false;
}
Source source = getSource(sourceId);
if (source != null) {
return removeSource(source);
}
- return null;
+ return false;
}
- @Nullable
- public Source removeSource(@NonNull Source source) {
+ public boolean removeSource(@NonNull Source source) {
if (checkState("removeSource")) {
- return null;
+ return false;
}
- nativeRemoveSource(source, source.getNativePtr());
- return source;
+ return nativeRemoveSource(source, source.getNativePtr());
}
public void addImage(@NonNull String name, @NonNull Bitmap image, boolean sdf) {
@@ -1217,16 +1217,11 @@ final class NativeMapView {
@Keep
private native void nativeAddLayerAt(long layerPtr, int index) throws CannotAddLayerException;
- @NonNull
@Keep
- private native Layer nativeRemoveLayerById(String layerId);
+ private native boolean nativeRemoveLayer(long layerId);
@Keep
- private native void nativeRemoveLayer(long layerId);
-
- @NonNull
- @Keep
- private native Layer nativeRemoveLayerAt(int index);
+ private native boolean nativeRemoveLayerAt(int index);
@NonNull
@Keep
@@ -1240,7 +1235,7 @@ final class NativeMapView {
private native void nativeAddSource(Source source, long sourcePtr) throws CannotAddSourceException;
@Keep
- private native void nativeRemoveSource(Source source, long sourcePtr);
+ private native boolean nativeRemoveSource(Source source, long sourcePtr);
@Keep
private native void nativeAddImage(String name, Bitmap bitmap, float pixelRatio, boolean sdf);