[android] layer list accessor + example
This commit is contained in:
committed by
Ivo van Dongen
parent
62e85c1224
commit
ec1dc2622b
@@ -209,6 +209,22 @@ public final class MapboxMap {
|
||||
nativeMapView.setTransitionDelay(delay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the layers in the style
|
||||
*
|
||||
* @return all the layers in the current style
|
||||
*/
|
||||
@UiThread
|
||||
public List<Layer> getLayers() {
|
||||
return nativeMapView.getLayers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the layer by id
|
||||
*
|
||||
* @param layerId the layer's id
|
||||
* @return the layer, if present in the style
|
||||
*/
|
||||
@Nullable
|
||||
@UiThread
|
||||
public Layer getLayer(@NonNull String layerId) {
|
||||
|
||||
@@ -747,6 +747,13 @@ final class NativeMapView {
|
||||
nativeSetTransitionDelay(delay);
|
||||
}
|
||||
|
||||
public List<Layer> getLayers() {
|
||||
if (isDestroyedOn("getLayers")) {
|
||||
return null;
|
||||
}
|
||||
return Arrays.asList(nativeGetLayers());
|
||||
}
|
||||
|
||||
public Layer getLayer(String layerId) {
|
||||
if (isDestroyedOn("getLayer")) {
|
||||
return null;
|
||||
@@ -1054,6 +1061,8 @@ final class NativeMapView {
|
||||
|
||||
private native void nativeSetTransitionDelay(long delay);
|
||||
|
||||
private native Layer[] nativeGetLayers();
|
||||
|
||||
private native Layer nativeGetLayer(String layerId);
|
||||
|
||||
private native void nativeAddLayer(long layerPtr, String before) throws CannotAddLayerException;
|
||||
|
||||
Reference in New Issue
Block a user