[android] remove layer at index
This commit is contained in:
committed by
Ivo van Dongen
parent
dc21396d71
commit
a9d2929819
@@ -8,6 +8,7 @@ import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.FloatRange;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -263,7 +264,7 @@ public final class MapboxMap {
|
||||
/**
|
||||
* 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 layer the layer to add
|
||||
* @param below the layer id to add this layer before
|
||||
*/
|
||||
@UiThread
|
||||
@@ -274,7 +275,7 @@ public final class MapboxMap {
|
||||
/**
|
||||
* 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 layer the layer to add
|
||||
* @param above the layer id to add this layer above
|
||||
*/
|
||||
@UiThread
|
||||
@@ -306,6 +307,18 @@ public final class MapboxMap {
|
||||
return nativeMapView.removeLayer(layer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the layer. Any other references to the layer become invalid and should not be used anymore
|
||||
*
|
||||
* @param index the layer index
|
||||
* @return the removed layer or null if not found
|
||||
*/
|
||||
@UiThread
|
||||
@Nullable
|
||||
public Layer removeLayerAt(@IntRange(from = 0) int index) {
|
||||
return nativeMapView.removeLayerAt(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the sources in the style
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
@@ -799,6 +800,14 @@ final class NativeMapView {
|
||||
return layer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Layer removeLayerAt(@IntRange(from = 0) int index) {
|
||||
if (isDestroyedOn("removeLayerAt")) {
|
||||
return null;
|
||||
}
|
||||
return nativeRemoveLayerAt(index);
|
||||
}
|
||||
|
||||
public List<Source> getSources() {
|
||||
if (isDestroyedOn("getSources")) {
|
||||
return null;
|
||||
@@ -1099,6 +1108,8 @@ final class NativeMapView {
|
||||
|
||||
private native void nativeRemoveLayer(long layerId);
|
||||
|
||||
private native Layer nativeRemoveLayerAt(int index);
|
||||
|
||||
private native Source[] nativeGetSources();
|
||||
|
||||
private native Source nativeGetSource(String sourceId);
|
||||
|
||||
Reference in New Issue
Block a user