[android] Custom layer bindings
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.mapbox.mapboxsdk.layers;
|
||||
|
||||
public class CustomLayer {
|
||||
public CustomLayer(String id,
|
||||
long context,
|
||||
long initializeFunction,
|
||||
long renderFunction,
|
||||
long deinitializeFunction) {
|
||||
this.mID = id;
|
||||
this.mContext = context;
|
||||
this.mInitializeFunction = initializeFunction;
|
||||
this.mRenderFunction = renderFunction;
|
||||
this.mDeinitializeFunction = deinitializeFunction;
|
||||
}
|
||||
|
||||
public String mID;
|
||||
public long mContext;
|
||||
public long mInitializeFunction;
|
||||
public long mRenderFunction;
|
||||
public long mDeinitializeFunction;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* This package contains classes to add and manage layers in your map.
|
||||
*/
|
||||
package com.mapbox.mapboxsdk.layers;
|
||||
@@ -74,6 +74,7 @@ import com.mapbox.mapboxsdk.geometry.BoundingBox;
|
||||
import com.mapbox.mapboxsdk.geometry.CoordinateBounds;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngZoom;
|
||||
import com.mapbox.mapboxsdk.layers.CustomLayer;
|
||||
import com.mapbox.mapboxsdk.utils.ApiAccess;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -3782,6 +3783,11 @@ public final class MapView extends FrameLayout {
|
||||
mAttributionsView.setVisibility(visibility);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void addCustomLayer(CustomLayer customLayer, String before) {
|
||||
mNativeMapView.addCustomLayer(customLayer, before);
|
||||
}
|
||||
|
||||
private void setWidgetGravity(@NonNull final View view, int gravity) {
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
layoutParams.gravity = gravity;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mapbox.mapboxsdk.geometry.BoundingBox;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngZoom;
|
||||
import com.mapbox.mapboxsdk.geometry.ProjectedMeters;
|
||||
import com.mapbox.mapboxsdk.layers.CustomLayer;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
@@ -449,6 +450,10 @@ final class NativeMapView {
|
||||
return nativeGetTopOffsetPixelsForAnnotationSymbol(mNativeMapViewPtr, symbolName);
|
||||
}
|
||||
|
||||
public void addCustomLayer(CustomLayer customLayer, String before) {
|
||||
nativeAddCustomLayer(mNativeMapViewPtr, customLayer, before);
|
||||
}
|
||||
|
||||
//
|
||||
// Callbacks
|
||||
//
|
||||
@@ -629,4 +634,6 @@ final class NativeMapView {
|
||||
private native LatLng nativeLatLngForPixel(long nativeMapViewPtr, PointF pixel);
|
||||
|
||||
private native double nativeGetTopOffsetPixelsForAnnotationSymbol(long nativeMapViewPtr, String symbolName);
|
||||
|
||||
private native void nativeAddCustomLayer(long nativeMapViewPtr, CustomLayer customLayer, String before);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user