[android] insert layer at index
This commit is contained in:
committed by
Ivo van Dongen
parent
a9d2929819
commit
99786e1e3f
@@ -283,6 +283,18 @@ public final class MapboxMap {
|
||||
nativeMapView.addLayerAbove(layer, above);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the layer to the map at the specified index. The layer must be newly
|
||||
* created and not added to the map before
|
||||
*
|
||||
* @param layer the layer to add
|
||||
* @param index the index to insert the layer at
|
||||
*/
|
||||
@UiThread
|
||||
public void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index) {
|
||||
nativeMapView.addLayerAt(layer, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the layer. Any references to the layer become invalid and should not be used anymore
|
||||
*
|
||||
|
||||
@@ -783,6 +783,13 @@ final class NativeMapView {
|
||||
nativeAddLayerAbove(layer.getNativePtr(), above);
|
||||
}
|
||||
|
||||
public void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index) {
|
||||
if (isDestroyedOn("addLayerAt")) {
|
||||
return;
|
||||
}
|
||||
nativeAddLayerAt(layer.getNativePtr(), index);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Layer removeLayer(@NonNull String layerId) {
|
||||
if (isDestroyedOn("removeLayer")) {
|
||||
@@ -1104,6 +1111,8 @@ final class NativeMapView {
|
||||
|
||||
private native void nativeAddLayerAbove(long layerPtr, String above) throws CannotAddLayerException;
|
||||
|
||||
private native void nativeAddLayerAt(long layerPtr, int index) throws CannotAddLayerException;
|
||||
|
||||
private native Layer nativeRemoveLayerById(String layerId);
|
||||
|
||||
private native void nativeRemoveLayer(long layerId);
|
||||
|
||||
Reference in New Issue
Block a user