[android] remove layer returns reference
This commit is contained in:
committed by
Ivo van Dongen
parent
609cdb0fd7
commit
fedb21e35b
@@ -275,20 +275,24 @@ public final class MapboxMap {
|
||||
* Removes the layer. Any references to the layer become invalid and should not be used anymore
|
||||
*
|
||||
* @param layerId the layer to remove
|
||||
* @return the removed layer or null if not found
|
||||
*/
|
||||
@UiThread
|
||||
public void removeLayer(@NonNull String layerId) {
|
||||
nativeMapView.removeLayer(layerId);
|
||||
@Nullable
|
||||
public Layer removeLayer(@NonNull String layerId) {
|
||||
return nativeMapView.removeLayer(layerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the layer. The reference is re-usable after this and can be re-added
|
||||
*
|
||||
* @param layer the layer to remove
|
||||
* @return the layer
|
||||
*/
|
||||
@UiThread
|
||||
public void removeLayer(@NonNull Layer layer) {
|
||||
nativeMapView.removeLayer(layer);
|
||||
@Nullable
|
||||
public Layer removeLayer(@NonNull Layer layer) {
|
||||
return nativeMapView.removeLayer(layer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -768,18 +768,21 @@ final class NativeMapView {
|
||||
nativeAddLayer(layer.getNativePtr(), before);
|
||||
}
|
||||
|
||||
public void removeLayer(@NonNull String layerId) {
|
||||
@Nullable
|
||||
public Layer removeLayer(@NonNull String layerId) {
|
||||
if (isDestroyedOn("removeLayer")) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
nativeRemoveLayerById(layerId);
|
||||
return nativeRemoveLayerById(layerId);
|
||||
}
|
||||
|
||||
public void removeLayer(@NonNull Layer layer) {
|
||||
@Nullable
|
||||
public Layer removeLayer(@NonNull Layer layer) {
|
||||
if (isDestroyedOn("removeLayer")) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
nativeRemoveLayer(layer.getNativePtr());
|
||||
return layer;
|
||||
}
|
||||
|
||||
public List<Source> getSources() {
|
||||
@@ -1074,7 +1077,7 @@ final class NativeMapView {
|
||||
|
||||
private native void nativeAddLayer(long layerPtr, String before) throws CannotAddLayerException;
|
||||
|
||||
private native void nativeRemoveLayerById(String layerId);
|
||||
private native Layer nativeRemoveLayerById(String layerId);
|
||||
|
||||
private native void nativeRemoveLayer(long layerId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user