diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java')
2 files changed, 34 insertions, 7 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 ecea6b2244..9b40685408 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 @@ -257,18 +257,29 @@ public final class MapboxMap { */ @UiThread public void addLayer(@NonNull Layer layer) { - addLayer(layer, null); + nativeMapView.addLayer(layer); } /** * Adds the layer to the map. The layer must be newly created and not added to the map before * * @param layer the layer to add - * @param before the layer id to add this layer before + * @param below the layer id to add this layer before */ @UiThread - public void addLayer(@NonNull Layer layer, String before) { - nativeMapView.addLayer(layer, before); + public void addLayerBelow(@NonNull Layer layer, @NonNull String below) { + nativeMapView.addLayerBelow(layer, below); + } + + /** + * Adds the layer to the map. The layer must be newly created and not added to the map before + * + * @param layer the layer to add + * @param above the layer id to add this layer above + */ + @UiThread + public void addLayerAbove(@NonNull Layer layer, @NonNull String above) { + nativeMapView.addLayerAbove(layer, above); } /** 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 47f4ad722e..a816808f7b 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 @@ -761,11 +761,25 @@ final class NativeMapView { return nativeGetLayer(layerId); } - public void addLayer(@NonNull Layer layer, @Nullable String before) { - if (isDestroyedOn("")) { + public void addLayer(@NonNull Layer layer) { + if (isDestroyedOn("addLayer")) { + return; + } + nativeAddLayer(layer.getNativePtr(), null); + } + + public void addLayerBelow(@NonNull Layer layer, @NonNull String below) { + if (isDestroyedOn("addLayerBelow")) { return; } - nativeAddLayer(layer.getNativePtr(), before); + nativeAddLayer(layer.getNativePtr(), below); + } + + public void addLayerAbove(@NonNull Layer layer, @NonNull String above) { + if (isDestroyedOn("addLayerAbove")) { + return; + } + nativeAddLayerAbove(layer.getNativePtr(), above); } @Nullable @@ -1079,6 +1093,8 @@ final class NativeMapView { private native void nativeAddLayer(long layerPtr, String before) throws CannotAddLayerException; + private native void nativeAddLayerAbove(long layerPtr, String above) throws CannotAddLayerException; + private native Layer nativeRemoveLayerById(String layerId); private native void nativeRemoveLayer(long layerId); |