[android] using @Keep annotation across the project with the help of lint checks
This commit is contained in:
committed by
Łukasz Paczos
parent
5fcd6e38a9
commit
94ad8e2ff8
@@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
|
||||
apply plugin: "com.jaredsburrows.license"
|
||||
|
||||
dependencies {
|
||||
lintChecks project(":MapboxGLAndroidSDKLint")
|
||||
api (dependenciesList.mapboxAndroidTelemetry) {
|
||||
exclude group: 'com.android.support', module: 'appcompat-v7'
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
-keepattributes Signature, *Annotation*, EnclosingMethod
|
||||
|
||||
# config for the SDK
|
||||
-keep class com.mapbox.mapboxsdk.** { *; }
|
||||
-keep interface com.mapbox.mapboxsdk.** { *; }
|
||||
-keep class com.google.gson.JsonArray { *; }
|
||||
-keep class com.google.gson.JsonElement { *; }
|
||||
-keep class com.google.gson.JsonObject { *; }
|
||||
-keep class com.google.gson.JsonPrimitive { *; }
|
||||
|
||||
# config for okhttp 3.8.0, https://github.com/square/okhttp/pull/3354
|
||||
-dontwarn okio.**
|
||||
@@ -23,7 +25,6 @@
|
||||
|
||||
# config for mapbox-sdk-geojson:3.0.1
|
||||
-keep class com.mapbox.geojson.** { *; }
|
||||
-keep class com.google.gson.** { *; }
|
||||
-dontnote com.google.gson.internal.UnsafeAllocator
|
||||
|
||||
# config for mapbox-android-gestures:0.0.1-20180228.152340-13
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.annotations;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -10,7 +12,9 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class BasePointCollection extends Annotation {
|
||||
|
||||
@Keep
|
||||
private List<LatLng> points;
|
||||
@Keep
|
||||
private float alpha = 1.0f;
|
||||
|
||||
protected BasePointCollection() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.annotations;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
@@ -27,10 +28,12 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
*/
|
||||
public class Marker extends Annotation {
|
||||
|
||||
@Keep
|
||||
private LatLng position;
|
||||
private String snippet;
|
||||
private Icon icon;
|
||||
//Redundantly stored for JNI access
|
||||
@Keep
|
||||
private String iconId;
|
||||
private String title;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.annotations;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
@@ -13,8 +14,11 @@ import java.util.List;
|
||||
*/
|
||||
public final class Polygon extends BasePointCollection {
|
||||
|
||||
@Keep
|
||||
private int fillColor = Color.BLACK; // default fillColor is black
|
||||
@Keep
|
||||
private int strokeColor = Color.BLACK; // default strokeColor is black
|
||||
@Keep
|
||||
private List<List<LatLng>> holes;
|
||||
|
||||
Polygon() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.annotations;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
|
||||
@@ -9,7 +10,9 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
*/
|
||||
public final class Polyline extends BasePointCollection {
|
||||
|
||||
@Keep
|
||||
private int color = Color.BLACK; // default color is black
|
||||
@Keep
|
||||
private float width = 10; // As specified by Google API Docs (in pixels)
|
||||
|
||||
Polyline() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.res.TypedArray;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.FloatRange;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.R;
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
@@ -35,23 +36,27 @@ public final class CameraPosition implements Parcelable {
|
||||
/**
|
||||
* Direction that the camera is pointing in, in degrees clockwise from north.
|
||||
*/
|
||||
@Keep
|
||||
public final double bearing;
|
||||
|
||||
/**
|
||||
* The location that the camera is pointing at.
|
||||
*/
|
||||
@Keep
|
||||
public final LatLng target;
|
||||
|
||||
/**
|
||||
* The angle, in degrees, of the camera angle from the nadir (directly facing the Earth).
|
||||
* See tilt(float) for details of restrictions on the range of values.
|
||||
*/
|
||||
@Keep
|
||||
public final double tilt;
|
||||
|
||||
/**
|
||||
* Zoom level near the center of the screen. See zoom(float) for the definition of the camera's
|
||||
* zoom level.
|
||||
*/
|
||||
@Keep
|
||||
public final double zoom;
|
||||
|
||||
/**
|
||||
@@ -67,6 +72,7 @@ public final class CameraPosition implements Parcelable {
|
||||
* @throws NullPointerException if target is null
|
||||
* @throws IllegalArgumentException if tilt is outside the range of 0 to 90 degrees inclusive.
|
||||
*/
|
||||
@Keep
|
||||
CameraPosition(LatLng target, double zoom, double tilt, double bearing) {
|
||||
this.target = target;
|
||||
this.bearing = bearing;
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.location.Location;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.FloatRange;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.constants.GeometryConstants;
|
||||
|
||||
@@ -35,7 +36,9 @@ public class LatLng implements ILatLng, Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
@Keep
|
||||
private double latitude;
|
||||
@Keep
|
||||
private double longitude;
|
||||
private double altitude = 0.0;
|
||||
|
||||
@@ -53,6 +56,7 @@ public class LatLng implements ILatLng, Parcelable {
|
||||
* @param latitude Latitude in degrees
|
||||
* @param longitude Longitude in degrees
|
||||
*/
|
||||
@Keep
|
||||
public LatLng(double latitude, double longitude) {
|
||||
setLatitude(latitude);
|
||||
setLongitude(longitude);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.geometry;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.FloatRange;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import com.mapbox.mapboxsdk.constants.GeometryConstants;
|
||||
@@ -19,9 +20,13 @@ import java.util.List;
|
||||
*/
|
||||
public class LatLngBounds implements Parcelable {
|
||||
|
||||
@Keep
|
||||
private final double latitudeNorth;
|
||||
@Keep
|
||||
private final double latitudeSouth;
|
||||
@Keep
|
||||
private final double longitudeEast;
|
||||
@Keep
|
||||
private final double longitudeWest;
|
||||
|
||||
/**
|
||||
@@ -37,6 +42,7 @@ public class LatLngBounds implements Parcelable {
|
||||
* @param southLatitude Southern Latitude
|
||||
* @param westLongitude Western Longitude
|
||||
*/
|
||||
@Keep
|
||||
LatLngBounds(final double northLatitude, final double eastLongitude, final double southLatitude,
|
||||
final double westLongitude) {
|
||||
this.latitudeNorth = northLatitude;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.geometry;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* A geographical area representing a non-aligned quadrilateral
|
||||
@@ -11,15 +12,20 @@ import android.os.Parcelable;
|
||||
*/
|
||||
public class LatLngQuad implements Parcelable {
|
||||
|
||||
@Keep
|
||||
private final LatLng topLeft;
|
||||
@Keep
|
||||
private final LatLng topRight;
|
||||
@Keep
|
||||
private final LatLng bottomRight;
|
||||
@Keep
|
||||
private final LatLng bottomLeft;
|
||||
|
||||
/**
|
||||
* Construct a new LatLngQuad based on its corners,
|
||||
* in order top left, top right, bottom left, bottom right
|
||||
*/
|
||||
@Keep
|
||||
public LatLngQuad(final LatLng topLeft, final LatLng topRight, final LatLng bottomRight, final LatLng bottomLeft) {
|
||||
this.topLeft = topLeft;
|
||||
this.topRight = topRight;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.geometry;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* ProjectedMeters is a projection of longitude, latitude points in Mercator meters.
|
||||
@@ -35,6 +36,7 @@ public class ProjectedMeters implements IProjectedMeters, Parcelable {
|
||||
* @param northing the northing in meters
|
||||
* @param easting the easting in meters
|
||||
*/
|
||||
@Keep
|
||||
public ProjectedMeters(double northing, double easting) {
|
||||
this.northing = northing;
|
||||
this.easting = easting;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.http;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -48,9 +49,11 @@ class HTTPRequest implements Callback {
|
||||
// Reentrancy is not needed, but "Lock" is an abstract class.
|
||||
private ReentrantLock lock = new ReentrantLock();
|
||||
private String userAgentString;
|
||||
@Keep
|
||||
private long nativePtr = 0;
|
||||
private Call call;
|
||||
|
||||
@Keep
|
||||
private HTTPRequest(long nativePtr, String resourceUrl, String etag, String modified) {
|
||||
this.nativePtr = nativePtr;
|
||||
|
||||
@@ -62,6 +65,7 @@ class HTTPRequest implements Callback {
|
||||
executeRequest(resourceUrl, etag, modified);
|
||||
}
|
||||
|
||||
@Keep
|
||||
public void cancel() {
|
||||
// call can be null if the constructor gets aborted (e.g, under a NoRouteToHostException).
|
||||
if (call != null) {
|
||||
@@ -266,8 +270,10 @@ class HTTPRequest implements Callback {
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native void nativeOnFailure(int type, String message);
|
||||
|
||||
@Keep
|
||||
private native void nativeOnResponse(int code, String etag, String modified, String cacheControl, String expires,
|
||||
String retryAfter, String xRateLimitReset, byte[] body);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.mapbox.mapboxsdk.maps;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
@Keep
|
||||
class Image {
|
||||
private final byte[] buffer;
|
||||
private final float pixelRatio;
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.support.v4.util.Pools;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapbox.android.gestures.AndroidGesturesManager;
|
||||
import com.mapbox.android.gestures.MoveGestureDetector;
|
||||
import com.mapbox.android.gestures.RotateGestureDetector;
|
||||
@@ -44,11 +45,12 @@ import com.mapbox.mapboxsdk.style.expressions.Expression;
|
||||
import com.mapbox.mapboxsdk.style.layers.Layer;
|
||||
import com.mapbox.mapboxsdk.style.light.Light;
|
||||
import com.mapbox.mapboxsdk.style.sources.Source;
|
||||
import timber.log.Timber;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
* The general class to interact with in the Android Mapbox SDK. It exposes the entry point for all
|
||||
* methods related to the MapView. You cannot instantiate {@link MapboxMap} object directly, rather,
|
||||
@@ -827,7 +829,7 @@ public final class MapboxMap {
|
||||
public final void animateCamera(@NonNull final CameraUpdate update, final int durationMs,
|
||||
@Nullable final MapboxMap.CancelableCallback callback) {
|
||||
if (durationMs <= 0) {
|
||||
throw new IllegalArgumentException("Null duration passed into animageCamera");
|
||||
throw new IllegalArgumentException("Null duration passed into animateCamera");
|
||||
}
|
||||
|
||||
transform.animateCamera(MapboxMap.this, update, durationMs, callback);
|
||||
@@ -1138,7 +1140,9 @@ public final class MapboxMap {
|
||||
* @param markerOptions A marker options object that defines how to render the marker
|
||||
* @return The {@code Marker} that was added to the map
|
||||
* @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
|
||||
* SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
* SDK views to be used as a symbol see https://github
|
||||
* .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
|
||||
* /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
*/
|
||||
@NonNull
|
||||
@Deprecated
|
||||
@@ -1157,7 +1161,9 @@ public final class MapboxMap {
|
||||
* @param onMarkerViewAddedListener Callback invoked when the View has been added to the map
|
||||
* @return The {@code Marker} that was added to the map
|
||||
* @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
|
||||
* SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
* SDK views to be used as a symbol see https://github
|
||||
* .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
|
||||
* /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
*/
|
||||
@Deprecated
|
||||
@NonNull
|
||||
@@ -1176,7 +1182,9 @@ public final class MapboxMap {
|
||||
* @param markerViewOptions A list of markerView options objects that defines how to render the markers
|
||||
* @return A list of the {@code MarkerView}s that were added to the map
|
||||
* @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
|
||||
* SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
* SDK views to be used as a symbol see https://github
|
||||
* .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
|
||||
* /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
*/
|
||||
@NonNull
|
||||
@Deprecated
|
||||
@@ -1191,7 +1199,9 @@ public final class MapboxMap {
|
||||
* @param rect the rectangular area on the map to query for markerViews
|
||||
* @return A list of the markerViews that were found in the rectangle
|
||||
* @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
|
||||
* SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
* SDK views to be used as a symbol see https://github
|
||||
* .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
|
||||
* /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
*/
|
||||
@NonNull
|
||||
@Deprecated
|
||||
@@ -2625,7 +2635,9 @@ public final class MapboxMap {
|
||||
*
|
||||
* @param <U> the instance type of MarkerView
|
||||
* @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
|
||||
* SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
* SDK views to be used as a symbol see https://github
|
||||
* .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
|
||||
* /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract static class MarkerViewAdapter<U extends MarkerView> {
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.graphics.RectF;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
@@ -64,6 +65,7 @@ final class NativeMapView {
|
||||
private boolean destroyed = false;
|
||||
|
||||
// Holds the pointer to JNI NativeMapView
|
||||
@Keep
|
||||
long nativePtr = 0;
|
||||
|
||||
// Listener invoked to return a bitmap of the map
|
||||
@@ -894,6 +896,7 @@ final class NativeMapView {
|
||||
// Callbacks
|
||||
//
|
||||
|
||||
@Keep
|
||||
protected void onMapChanged(int rawChange) {
|
||||
for (MapView.OnMapChangedListener onMapChangedListener : onMapChangedListeners) {
|
||||
try {
|
||||
@@ -904,6 +907,7 @@ final class NativeMapView {
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected void onSnapshotReady(Bitmap mapContent) {
|
||||
if (checkState("OnSnapshotReady")) {
|
||||
return;
|
||||
@@ -919,188 +923,273 @@ final class NativeMapView {
|
||||
// JNI methods
|
||||
//
|
||||
|
||||
@Keep
|
||||
private native void nativeInitialize(NativeMapView nativeMapView,
|
||||
FileSource fileSource,
|
||||
MapRenderer mapRenderer,
|
||||
float pixelRatio);
|
||||
|
||||
@Keep
|
||||
private native void nativeDestroy();
|
||||
|
||||
@Keep
|
||||
private native void nativeResizeView(int width, int height);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetStyleUrl(String url);
|
||||
|
||||
@Keep
|
||||
private native String nativeGetStyleUrl();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetStyleJson(String newStyleJson);
|
||||
|
||||
@Keep
|
||||
private native String nativeGetStyleJson();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLatLngBounds(LatLngBounds latLngBounds);
|
||||
|
||||
@Keep
|
||||
private native void nativeCancelTransitions();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetGestureInProgress(boolean inProgress);
|
||||
|
||||
@Keep
|
||||
private native void nativeMoveBy(double dx, double dy, long duration);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLatLng(double latitude, double longitude, long duration);
|
||||
|
||||
@Keep
|
||||
private native LatLng nativeGetLatLng();
|
||||
|
||||
@Keep
|
||||
private native CameraPosition nativeGetCameraForLatLngBounds(
|
||||
LatLngBounds latLngBounds, double top, double left, double bottom, double right, double bearing, double tilt);
|
||||
|
||||
@Keep
|
||||
private native CameraPosition nativeGetCameraForGeometry(
|
||||
Geometry geometry, double top, double left, double bottom, double right, double bearing, double tilt);
|
||||
|
||||
@Keep
|
||||
private native void nativeResetPosition();
|
||||
|
||||
@Keep
|
||||
private native double nativeGetPitch();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetPitch(double pitch, long duration);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetZoom(double zoom, double cx, double cy, long duration);
|
||||
|
||||
@Keep
|
||||
private native double nativeGetZoom();
|
||||
|
||||
@Keep
|
||||
private native void nativeResetZoom();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetMinZoom(double zoom);
|
||||
|
||||
@Keep
|
||||
private native double nativeGetMinZoom();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetMaxZoom(double zoom);
|
||||
|
||||
@Keep
|
||||
private native double nativeGetMaxZoom();
|
||||
|
||||
@Keep
|
||||
private native void nativeRotateBy(double sx, double sy, double ex, double ey, long duration);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetContentPadding(double top, double left, double bottom, double right);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetBearing(double degrees, long duration);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetBearingXY(double degrees, double fx, double fy, long duration);
|
||||
|
||||
@Keep
|
||||
private native double nativeGetBearing();
|
||||
|
||||
@Keep
|
||||
private native void nativeResetNorth();
|
||||
|
||||
@Keep
|
||||
private native void nativeUpdateMarker(long markerId, double lat, double lon, String iconId);
|
||||
|
||||
@Keep
|
||||
private native long[] nativeAddMarkers(Marker[] markers);
|
||||
|
||||
@Keep
|
||||
private native long[] nativeAddPolylines(Polyline[] polylines);
|
||||
|
||||
@Keep
|
||||
private native long[] nativeAddPolygons(Polygon[] polygons);
|
||||
|
||||
@Keep
|
||||
private native void nativeRemoveAnnotations(long[] id);
|
||||
|
||||
@Keep
|
||||
private native long[] nativeQueryPointAnnotations(RectF rect);
|
||||
|
||||
@Keep
|
||||
private native long[] nativeQueryShapeAnnotations(RectF rect);
|
||||
|
||||
@Keep
|
||||
private native void nativeAddAnnotationIcon(String symbol, int width, int height, float scale, byte[] pixels);
|
||||
|
||||
@Keep
|
||||
private native void nativeRemoveAnnotationIcon(String symbol);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetVisibleCoordinateBounds(LatLng[] coordinates, RectF padding,
|
||||
double direction, long duration);
|
||||
|
||||
@Keep
|
||||
private native void nativeOnLowMemory();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetDebug(boolean debug);
|
||||
|
||||
@Keep
|
||||
private native void nativeCycleDebugOptions();
|
||||
|
||||
@Keep
|
||||
private native boolean nativeGetDebug();
|
||||
|
||||
@Keep
|
||||
private native boolean nativeIsFullyLoaded();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetReachability(boolean status);
|
||||
|
||||
@Keep
|
||||
private native double nativeGetMetersPerPixelAtLatitude(double lat, double zoom);
|
||||
|
||||
@Keep
|
||||
private native ProjectedMeters nativeProjectedMetersForLatLng(double latitude, double longitude);
|
||||
|
||||
@Keep
|
||||
private native LatLng nativeLatLngForProjectedMeters(double northing, double easting);
|
||||
|
||||
@Keep
|
||||
private native PointF nativePixelForLatLng(double lat, double lon);
|
||||
|
||||
@Keep
|
||||
private native LatLng nativeLatLngForPixel(float x, float y);
|
||||
|
||||
@Keep
|
||||
private native double nativeGetTopOffsetPixelsForAnnotationSymbol(String symbolName);
|
||||
|
||||
@Keep
|
||||
private native void nativeJumpTo(double angle, double latitude, double longitude, double pitch, double zoom);
|
||||
|
||||
@Keep
|
||||
private native void nativeEaseTo(double angle, double latitude, double longitude,
|
||||
long duration, double pitch, double zoom,
|
||||
boolean easingInterpolator);
|
||||
|
||||
@Keep
|
||||
private native void nativeFlyTo(double angle, double latitude, double longitude,
|
||||
long duration, double pitch, double zoom);
|
||||
|
||||
@Keep
|
||||
private native CameraPosition nativeGetCameraPosition();
|
||||
|
||||
@Keep
|
||||
private native long nativeGetTransitionDuration();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTransitionDuration(long duration);
|
||||
|
||||
@Keep
|
||||
private native long nativeGetTransitionDelay();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTransitionDelay(long delay);
|
||||
|
||||
@Keep
|
||||
private native Layer[] nativeGetLayers();
|
||||
|
||||
@Keep
|
||||
private native Layer nativeGetLayer(String layerId);
|
||||
|
||||
@Keep
|
||||
private native void nativeAddLayer(long layerPtr, String before) throws CannotAddLayerException;
|
||||
|
||||
@Keep
|
||||
private native void nativeAddLayerAbove(long layerPtr, String above) throws CannotAddLayerException;
|
||||
|
||||
@Keep
|
||||
private native void nativeAddLayerAt(long layerPtr, int index) throws CannotAddLayerException;
|
||||
|
||||
@Keep
|
||||
private native Layer nativeRemoveLayerById(String layerId);
|
||||
|
||||
@Keep
|
||||
private native void nativeRemoveLayer(long layerId);
|
||||
|
||||
@Keep
|
||||
private native Layer nativeRemoveLayerAt(int index);
|
||||
|
||||
@Keep
|
||||
private native Source[] nativeGetSources();
|
||||
|
||||
@Keep
|
||||
private native Source nativeGetSource(String sourceId);
|
||||
|
||||
@Keep
|
||||
private native void nativeAddSource(Source source, long sourcePtr) throws CannotAddSourceException;
|
||||
|
||||
@Keep
|
||||
private native void nativeRemoveSource(Source source, long sourcePtr);
|
||||
|
||||
@Keep
|
||||
private native void nativeAddImage(String name, Bitmap bitmap, float pixelRatio, boolean sdf);
|
||||
|
||||
@Keep
|
||||
private native void nativeAddImages(Image[] images);
|
||||
|
||||
@Keep
|
||||
private native void nativeRemoveImage(String name);
|
||||
|
||||
@Keep
|
||||
private native Bitmap nativeGetImage(String name);
|
||||
|
||||
@Keep
|
||||
private native void nativeUpdatePolygon(long polygonId, Polygon polygon);
|
||||
|
||||
@Keep
|
||||
private native void nativeUpdatePolyline(long polylineId, Polyline polyline);
|
||||
|
||||
@Keep
|
||||
private native void nativeTakeSnapshot();
|
||||
|
||||
@Keep
|
||||
private native Feature[] nativeQueryRenderedFeaturesForPoint(float x, float y,
|
||||
String[] layerIds,
|
||||
Object[] filter);
|
||||
|
||||
@Keep
|
||||
private native Feature[] nativeQueryRenderedFeaturesForBox(float left, float top,
|
||||
float right, float bottom,
|
||||
String[] layerIds,
|
||||
Object[] filter);
|
||||
|
||||
@Keep
|
||||
private native Light nativeGetLight();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetPrefetchesTiles(boolean enable);
|
||||
|
||||
@Keep
|
||||
private native boolean nativeGetPrefetchesTiles();
|
||||
|
||||
int getWidth() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.maps.renderer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.storage.FileSource;
|
||||
@@ -16,6 +17,7 @@ import javax.microedition.khronos.opengles.GL10;
|
||||
* render on the one end and acts as a scheduler to request work to
|
||||
* be performed on the GL thread on the other.
|
||||
*/
|
||||
@Keep
|
||||
public abstract class MapRenderer implements MapRendererScheduler {
|
||||
|
||||
// Holds the pointer to the native peer after initialisation
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.mapbox.mapboxsdk.maps.renderer;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* Peer class for {@link Runnable}s to be scheduled on the {@link MapRenderer} thread.
|
||||
* The actual work is performed in the native peer.
|
||||
*/
|
||||
@Keep
|
||||
class MapRendererRunnable implements Runnable {
|
||||
|
||||
// Holds the pointer to the native peer after initialisation
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package com.mapbox.mapboxsdk.maps.renderer;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* Can be used to schedule work on the map renderer
|
||||
* thread or request a render.
|
||||
*/
|
||||
public interface MapRendererScheduler {
|
||||
|
||||
@Keep
|
||||
void requestRender();
|
||||
|
||||
@Keep
|
||||
void queueEvent(Runnable runnable);
|
||||
|
||||
}
|
||||
|
||||
@@ -77,5 +77,4 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi
|
||||
glSurfaceView.queueEvent(runnable);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.net;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.LibraryLoader;
|
||||
|
||||
/**
|
||||
@@ -11,9 +13,12 @@ class NativeConnectivityListener implements ConnectivityListener {
|
||||
LibraryLoader.load();
|
||||
}
|
||||
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
@Keep
|
||||
private boolean invalidated;
|
||||
|
||||
@Keep
|
||||
NativeConnectivityListener(long nativePtr) {
|
||||
this.nativePtr = nativePtr;
|
||||
}
|
||||
@@ -27,10 +32,13 @@ class NativeConnectivityListener implements ConnectivityListener {
|
||||
nativeOnConnectivityStateChanged(connected);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void nativeOnConnectivityStateChanged(boolean connected);
|
||||
|
||||
@Keep
|
||||
protected native void initialize();
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.mapbox.mapboxsdk.LibraryLoader;
|
||||
@@ -31,6 +32,7 @@ public class OfflineManager {
|
||||
}
|
||||
|
||||
// Native peer pointer
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
|
||||
// Reference to the file source to keep it alive for the
|
||||
@@ -51,6 +53,7 @@ public class OfflineManager {
|
||||
* This callback receives an asynchronous response containing a list of all
|
||||
* OfflineRegion in the database or an error message otherwise.
|
||||
*/
|
||||
@Keep
|
||||
public interface ListOfflineRegionsCallback {
|
||||
/**
|
||||
* Receives the list of offline regions.
|
||||
@@ -71,6 +74,7 @@ public class OfflineManager {
|
||||
* This callback receives an asynchronous response containing the newly created
|
||||
* OfflineRegion in the database or an error message otherwise.
|
||||
*/
|
||||
@Keep
|
||||
public interface CreateOfflineRegionCallback {
|
||||
/**
|
||||
* Receives the newly created offline region.
|
||||
@@ -249,15 +253,20 @@ public class OfflineManager {
|
||||
*
|
||||
* @param limit the new tile count limit.
|
||||
*/
|
||||
@Keep
|
||||
public native void setOfflineMapboxTileCountLimit(long limit);
|
||||
|
||||
@Keep
|
||||
private native void initialize(FileSource fileSource);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
@Keep
|
||||
private native void listOfflineRegions(FileSource fileSource, ListOfflineRegionsCallback callback);
|
||||
|
||||
@Keep
|
||||
private native void createOfflineRegion(FileSource fileSource, OfflineRegionDefinition definition,
|
||||
byte[] metadata, CreateOfflineRegionCallback callback);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.offline;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.annotation.IntDef;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import com.mapbox.mapboxsdk.LibraryLoader;
|
||||
@@ -30,6 +31,7 @@ public class OfflineRegion {
|
||||
// Members
|
||||
|
||||
// Holds the pointer to JNI OfflineRegion
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
|
||||
// Holds a reference to the FileSource to keep it alive
|
||||
@@ -57,6 +59,7 @@ public class OfflineRegion {
|
||||
* A region can have a single observer, which gets notified whenever a change
|
||||
* to the region's status occurs.
|
||||
*/
|
||||
@Keep
|
||||
public interface OfflineRegionObserver {
|
||||
/**
|
||||
* Implement this method to be notified of a change in the status of an
|
||||
@@ -102,6 +105,7 @@ public class OfflineRegion {
|
||||
* This callback receives an asynchronous response containing the OfflineRegionStatus
|
||||
* of the offline region, or a {@link String} error message otherwise.
|
||||
*/
|
||||
@Keep
|
||||
public interface OfflineRegionStatusCallback {
|
||||
/**
|
||||
* Receives the status
|
||||
@@ -122,6 +126,7 @@ public class OfflineRegion {
|
||||
* This callback receives an asynchronous response containing a notification when
|
||||
* an offline region has been deleted, or a {@link String} error message otherwise.
|
||||
*/
|
||||
@Keep
|
||||
public interface OfflineRegionDeleteCallback {
|
||||
/**
|
||||
* Receives the delete notification
|
||||
@@ -140,6 +145,7 @@ public class OfflineRegion {
|
||||
* This callback receives an asynchronous response containing the newly update
|
||||
* OfflineMetadata in the database, or an error message otherwise.
|
||||
*/
|
||||
@Keep
|
||||
public interface OfflineRegionUpdateMetadataCallback {
|
||||
/**
|
||||
* Receives the newly update offline region metadata.
|
||||
@@ -214,6 +220,7 @@ public class OfflineRegion {
|
||||
* For JNI use only, to create a new offline region, use
|
||||
* {@link OfflineManager#createOfflineRegion} instead.
|
||||
*/
|
||||
@Keep
|
||||
private OfflineRegion(long offlineRegionPtr, FileSource fileSource, long id,
|
||||
OfflineRegionDefinition definition, byte[] metadata) {
|
||||
this.fileSource = fileSource;
|
||||
@@ -427,19 +434,26 @@ public class OfflineRegion {
|
||||
});
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native void initialize(long offlineRegionPtr, FileSource fileSource);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize();
|
||||
|
||||
@Keep
|
||||
private native void setOfflineRegionObserver(OfflineRegionObserver callback);
|
||||
|
||||
@Keep
|
||||
private native void setOfflineRegionDownloadState(@DownloadState int offlineRegionDownloadState);
|
||||
|
||||
@Keep
|
||||
private native void getOfflineRegionStatus(OfflineRegionStatusCallback callback);
|
||||
|
||||
@Keep
|
||||
private native void deleteOfflineRegion(OfflineRegionDeleteCallback callback);
|
||||
|
||||
@Keep
|
||||
private native void updateOfflineRegionMetadata(byte[] metadata, OfflineRegionUpdateMetadataCallback callback);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.offline;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
|
||||
/**
|
||||
@@ -7,6 +9,7 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
* <p>
|
||||
* For the present, a tile pyramid is the only type of offline region.
|
||||
*/
|
||||
@Keep
|
||||
public interface OfflineRegionDefinition {
|
||||
|
||||
LatLngBounds getBounds();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.offline;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.StringDef;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -34,7 +35,7 @@ public class OfflineRegionError {
|
||||
private final String message;
|
||||
|
||||
// Constructors
|
||||
|
||||
@Keep
|
||||
private OfflineRegionError(String reason, String message) {
|
||||
// For JNI use only
|
||||
this.reason = reason;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.offline;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* A region's status includes its active/inactive state as well as counts
|
||||
* of the number of resources that have completed downloading, their total
|
||||
@@ -61,6 +63,7 @@ public class OfflineRegionStatus {
|
||||
*
|
||||
* For JNI use only
|
||||
*/
|
||||
@Keep
|
||||
private OfflineRegionStatus(int downloadState, long completedResourceCount,
|
||||
long completedResourceSize, long completedTileCount,
|
||||
long completedTileSize, long requiredResourceCount,
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.offline;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
@@ -19,10 +20,15 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
*/
|
||||
public class OfflineTilePyramidRegionDefinition implements OfflineRegionDefinition, Parcelable {
|
||||
|
||||
@Keep
|
||||
private String styleURL;
|
||||
@Keep
|
||||
private LatLngBounds bounds;
|
||||
@Keep
|
||||
private double minZoom;
|
||||
@Keep
|
||||
private double maxZoom;
|
||||
@Keep
|
||||
private float pixelRatio;
|
||||
|
||||
/**
|
||||
@@ -34,6 +40,7 @@ public class OfflineTilePyramidRegionDefinition implements OfflineRegionDefiniti
|
||||
* @param maxZoom max zoom
|
||||
* @param pixelRatio pixel ratio of the device
|
||||
*/
|
||||
@Keep
|
||||
public OfflineTilePyramidRegionDefinition(
|
||||
String styleURL, LatLngBounds bounds, double minZoom, double maxZoom, float pixelRatio) {
|
||||
// Note: Also used in JNI
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.snapshotter;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PointF;
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
|
||||
@@ -12,6 +13,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
*/
|
||||
public class MapSnapshot {
|
||||
|
||||
@Keep
|
||||
private long nativePtr = 0;
|
||||
private Bitmap bitmap;
|
||||
private String[] attributions;
|
||||
@@ -20,6 +22,7 @@ public class MapSnapshot {
|
||||
/**
|
||||
* Created from native side
|
||||
*/
|
||||
@Keep
|
||||
private MapSnapshot(long nativePtr, Bitmap bitmap, String[] attributions, boolean showLogo) {
|
||||
this.nativePtr = nativePtr;
|
||||
this.bitmap = bitmap;
|
||||
@@ -40,6 +43,7 @@ public class MapSnapshot {
|
||||
* @param latLng the geographical coordinates
|
||||
* @return the point on the image
|
||||
*/
|
||||
@Keep
|
||||
public native PointF pixelForLatLng(LatLng latLng);
|
||||
|
||||
/**
|
||||
@@ -48,6 +52,7 @@ public class MapSnapshot {
|
||||
* @param pointF the point in pixels
|
||||
* @return the geographical coordinates
|
||||
*/
|
||||
@Keep
|
||||
public native LatLng latLngForPixel(PointF pointF);
|
||||
|
||||
/**
|
||||
@@ -65,7 +70,9 @@ public class MapSnapshot {
|
||||
}
|
||||
|
||||
// Unused, needed for peer binding
|
||||
@Keep
|
||||
private native void initialize();
|
||||
|
||||
@Keep
|
||||
protected native void finalize();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -71,6 +72,7 @@ public class MapSnapshotter {
|
||||
private static final int LOGO_MARGIN_DP = 4;
|
||||
|
||||
// Holds the pointer to JNI NativeMapView
|
||||
@Keep
|
||||
private long nativePtr = 0;
|
||||
|
||||
private final Context context;
|
||||
@@ -255,6 +257,7 @@ public class MapSnapshotter {
|
||||
* @param width the width
|
||||
* @param height the height
|
||||
*/
|
||||
@Keep
|
||||
public native void setSize(int width, int height);
|
||||
|
||||
/**
|
||||
@@ -262,6 +265,7 @@ public class MapSnapshotter {
|
||||
*
|
||||
* @param cameraPosition the camera position
|
||||
*/
|
||||
@Keep
|
||||
public native void setCameraPosition(CameraPosition cameraPosition);
|
||||
|
||||
/**
|
||||
@@ -269,6 +273,7 @@ public class MapSnapshotter {
|
||||
*
|
||||
* @param region the region
|
||||
*/
|
||||
@Keep
|
||||
public native void setRegion(LatLngBounds region);
|
||||
|
||||
/**
|
||||
@@ -276,6 +281,7 @@ public class MapSnapshotter {
|
||||
*
|
||||
* @param styleUrl the style url
|
||||
*/
|
||||
@Keep
|
||||
public native void setStyleUrl(String styleUrl);
|
||||
|
||||
/**
|
||||
@@ -283,6 +289,7 @@ public class MapSnapshotter {
|
||||
*
|
||||
* @param styleJson the style json
|
||||
*/
|
||||
@Keep
|
||||
public native void setStyleJson(String styleJson);
|
||||
|
||||
/**
|
||||
@@ -446,6 +453,7 @@ public class MapSnapshotter {
|
||||
*
|
||||
* @param snapshot the generated snapshot
|
||||
*/
|
||||
@Keep
|
||||
protected void onSnapshotReady(final MapSnapshot snapshot) {
|
||||
new Handler().post(new Runnable() {
|
||||
@Override
|
||||
@@ -465,6 +473,7 @@ public class MapSnapshotter {
|
||||
*
|
||||
* @param reason the exception string
|
||||
*/
|
||||
@Keep
|
||||
protected void onSnapshotFailed(String reason) {
|
||||
if (errorHandler != null) {
|
||||
errorHandler.onError(reason);
|
||||
@@ -481,17 +490,21 @@ public class MapSnapshotter {
|
||||
errorHandler = null;
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void nativeInitialize(MapSnapshotter mapSnapshotter,
|
||||
FileSource fileSource, float pixelRatio,
|
||||
int width, int height, String styleUrl, String styleJson,
|
||||
LatLngBounds region, CameraPosition position,
|
||||
boolean showLogo, String programCacheDir);
|
||||
|
||||
@Keep
|
||||
protected native void nativeStart();
|
||||
|
||||
@Keep
|
||||
protected native void nativeCancel();
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
private class Logo {
|
||||
|
||||
@@ -5,11 +5,13 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
import com.mapbox.mapboxsdk.Mapbox;
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
@@ -23,6 +25,7 @@ public class FileSource {
|
||||
* from the internet. This can be used add or remove custom parameters, or reroute
|
||||
* certain requests to other servers or endpoints.
|
||||
*/
|
||||
@Keep
|
||||
public interface ResourceTransformCallback {
|
||||
|
||||
/**
|
||||
@@ -119,22 +122,29 @@ public class FileSource {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
|
||||
private FileSource(String cachePath, AssetManager assetManager) {
|
||||
initialize(Mapbox.getAccessToken(), cachePath, assetManager);
|
||||
}
|
||||
|
||||
@Keep
|
||||
public native boolean isActivated();
|
||||
|
||||
@Keep
|
||||
public native void activate();
|
||||
|
||||
@Keep
|
||||
public native void deactivate();
|
||||
|
||||
@Keep
|
||||
public native void setAccessToken(@NonNull String accessToken);
|
||||
|
||||
@Keep
|
||||
public native String getAccessToken();
|
||||
|
||||
@Keep
|
||||
public native void setApiBaseUrl(String baseUrl);
|
||||
|
||||
/**
|
||||
@@ -145,11 +155,14 @@ public class FileSource {
|
||||
*
|
||||
* @param callback the callback to be invoked or null to reset
|
||||
*/
|
||||
@Keep
|
||||
public native void setResourceTransform(final ResourceTransformCallback callback);
|
||||
|
||||
@Keep
|
||||
private native void initialize(String accessToken, String cachePath, AssetManager assetManager);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class BackgroundLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public BackgroundLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -40,6 +42,7 @@ public class BackgroundLayer extends Layer {
|
||||
initialize(layerId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId);
|
||||
|
||||
/**
|
||||
@@ -165,25 +168,35 @@ public class BackgroundLayer extends Layer {
|
||||
nativeSetBackgroundOpacityTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetBackgroundColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetBackgroundColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetBackgroundColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetBackgroundPattern();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetBackgroundPatternTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetBackgroundPatternTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetBackgroundOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetBackgroundOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetBackgroundOpacityTransition(long duration, long delay);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* Thrown when adding a layer to a map twice
|
||||
*/
|
||||
@Keep
|
||||
public class CannotAddLayerException extends RuntimeException {
|
||||
|
||||
public CannotAddLayerException(String message) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class CircleLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public CircleLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class CircleLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -439,61 +442,89 @@ public class CircleLayer extends Layer {
|
||||
nativeSetCircleStrokeOpacityTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleRadius();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleRadiusTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleRadiusTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleBlur();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleBlurTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleBlurTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleOpacityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleTranslate();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleTranslateTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleTranslateTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleTranslateAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCirclePitchScale();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCirclePitchAlignment();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleStrokeWidth();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleStrokeWidthTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleStrokeWidthTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleStrokeColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleStrokeColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleStrokeColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetCircleStrokeOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetCircleStrokeOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetCircleStrokeOpacityTransition(long duration, long delay);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* Custom layer.
|
||||
* <p>
|
||||
@@ -13,6 +15,7 @@ public class CustomLayer extends Layer {
|
||||
initialize(id, host);
|
||||
}
|
||||
|
||||
@Keep
|
||||
public CustomLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -21,11 +24,14 @@ public class CustomLayer extends Layer {
|
||||
nativeUpdate();
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String id, long host);
|
||||
|
||||
@Keep
|
||||
protected native void nativeUpdate();
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class FillExtrusionLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public FillExtrusionLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class FillExtrusionLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -338,45 +341,65 @@ public class FillExtrusionLayer extends Layer {
|
||||
nativeSetFillExtrusionBaseTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillExtrusionOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillExtrusionOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillExtrusionOpacityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillExtrusionColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillExtrusionColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillExtrusionColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillExtrusionTranslate();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillExtrusionTranslateTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillExtrusionTranslateTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillExtrusionTranslateAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillExtrusionPattern();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillExtrusionPatternTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillExtrusionPatternTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillExtrusionHeight();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillExtrusionHeightTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillExtrusionHeightTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillExtrusionBase();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillExtrusionBaseTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillExtrusionBaseTransition(long duration, long delay);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class FillLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public FillLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class FillLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -335,41 +338,59 @@ public class FillLayer extends Layer {
|
||||
nativeSetFillPatternTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillAntialias();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillOpacityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillOutlineColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillOutlineColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillOutlineColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillTranslate();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillTranslateTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillTranslateTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillTranslateAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetFillPattern();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetFillPatternTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFillPatternTransition(long duration, long delay);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class HeatmapLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public HeatmapLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class HeatmapLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -256,29 +259,41 @@ public class HeatmapLayer extends Layer {
|
||||
nativeSetHeatmapOpacityTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHeatmapRadius();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetHeatmapRadiusTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetHeatmapRadiusTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHeatmapWeight();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHeatmapIntensity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetHeatmapIntensityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetHeatmapIntensityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHeatmapColor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHeatmapOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetHeatmapOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetHeatmapOpacityTransition(long duration, long delay);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class HillshadeLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public HillshadeLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class HillshadeLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -274,35 +277,50 @@ public class HillshadeLayer extends Layer {
|
||||
nativeSetHillshadeAccentColorTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeIlluminationDirection();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeIlluminationAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeExaggeration();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetHillshadeExaggerationTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetHillshadeExaggerationTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeShadowColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetHillshadeShadowColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetHillshadeShadowColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeHighlightColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetHillshadeHighlightColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetHillshadeHighlightColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeAccentColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetHillshadeAccentColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetHillshadeAccentColorTransition(long duration, long delay);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
@@ -11,9 +12,12 @@ import com.mapbox.mapboxsdk.utils.ThreadUtils;
|
||||
*/
|
||||
public abstract class Layer {
|
||||
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
@Keep
|
||||
private boolean invalidated;
|
||||
|
||||
@Keep
|
||||
public Layer(long nativePtr) {
|
||||
checkThread();
|
||||
this.nativePtr = nativePtr;
|
||||
@@ -77,30 +81,43 @@ public abstract class Layer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetId();
|
||||
|
||||
@Keep
|
||||
protected native Object nativeGetVisibility();
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetLayoutProperty(String name, Object value);
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetPaintProperty(String name, Object value);
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetFilter(Object[] filter);
|
||||
|
||||
@Keep
|
||||
protected native JsonElement nativeGetFilter();
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetSourceLayer(String sourceLayer);
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetSourceLayer();
|
||||
|
||||
@Keep
|
||||
protected native float nativeGetMinZoom();
|
||||
|
||||
@Keep
|
||||
protected native float nativeGetMaxZoom();
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetMinZoom(float zoom);
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetMaxZoom(float zoom);
|
||||
|
||||
public long getNativePtr() {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class LineLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public LineLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class LineLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -475,71 +478,104 @@ public class LineLayer extends Layer {
|
||||
nativeSetLinePatternTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineCap();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineJoin();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineMiterLimit();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineRoundLimit();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineOpacityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineTranslate();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineTranslateTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineTranslateTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineTranslateAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineWidth();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineWidthTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineWidthTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineGapWidth();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineGapWidthTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineGapWidthTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineOffset();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineOffsetTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineOffsetTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineBlur();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineBlurTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineBlurTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLineDasharray();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLineDasharrayTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLineDasharrayTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetLinePattern();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetLinePatternTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetLinePatternTransition(long duration, long delay);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class RasterLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public RasterLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class RasterLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -285,47 +288,68 @@ public class RasterLayer extends Layer {
|
||||
return (PropertyValue<Float>) new PropertyValue("raster-fade-duration", nativeGetRasterFadeDuration());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetRasterOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetRasterOpacityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterHueRotate();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetRasterHueRotateTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetRasterHueRotateTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterBrightnessMin();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetRasterBrightnessMinTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetRasterBrightnessMinTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterBrightnessMax();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetRasterBrightnessMaxTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetRasterBrightnessMaxTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterSaturation();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetRasterSaturationTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetRasterSaturationTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterContrast();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetRasterContrastTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetRasterContrastTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterResampling();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetRasterFadeDuration();
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -26,6 +27,7 @@ public class SymbolLayer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public SymbolLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -41,6 +43,7 @@ public class SymbolLayer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -982,155 +985,230 @@ public class SymbolLayer extends Layer {
|
||||
return (PropertyValue<String>) new PropertyValue("text-translate-anchor", nativeGetTextTranslateAnchor());
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetSymbolPlacement();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetSymbolSpacing();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetSymbolAvoidEdges();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconAllowOverlap();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconIgnorePlacement();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconOptional();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconRotationAlignment();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconSize();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconTextFit();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconTextFitPadding();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconImage();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconRotate();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconPadding();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconKeepUpright();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconOffset();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconPitchAlignment();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextPitchAlignment();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextRotationAlignment();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextField();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextFont();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextSize();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextMaxWidth();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextLineHeight();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextLetterSpacing();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextJustify();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextMaxAngle();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextRotate();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextPadding();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextKeepUpright();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextTransform();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextOffset();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextAllowOverlap();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextIgnorePlacement();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextOptional();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetIconOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetIconOpacityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetIconColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetIconColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconHaloColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetIconHaloColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetIconHaloColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconHaloWidth();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetIconHaloWidthTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetIconHaloWidthTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconHaloBlur();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetIconHaloBlurTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetIconHaloBlurTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconTranslate();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetIconTranslateTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetIconTranslateTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetIconTranslateAnchor();
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextOpacity();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetTextOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTextOpacityTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetTextColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTextColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextHaloColor();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetTextHaloColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTextHaloColorTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextHaloWidth();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetTextHaloWidthTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTextHaloWidthTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextHaloBlur();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetTextHaloBlurTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTextHaloBlurTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextTranslate();
|
||||
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetTextTranslateTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTextTranslateTransition(long duration, long delay);
|
||||
|
||||
@Keep
|
||||
private native Object nativeGetTextTranslateAnchor();
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* Resembles transition property from the style specification.
|
||||
*
|
||||
@@ -28,6 +30,7 @@ public class TransitionOptions {
|
||||
* @param delay the delay to start the transition
|
||||
* @return a new transition property object
|
||||
*/
|
||||
@Keep
|
||||
public static TransitionOptions fromTransitionOptions(long duration, long delay) {
|
||||
return new TransitionOptions(duration, delay);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
/**
|
||||
* An unknown type of layer
|
||||
*/
|
||||
@UiThread
|
||||
@Keep
|
||||
public class UnknownLayer extends Layer {
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package com.mapbox.mapboxsdk.style.layers;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -31,6 +32,7 @@ public class <%- camelize(type) %>Layer extends Layer {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public <%- camelize(type) %>Layer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -46,6 +48,7 @@ public class <%- camelize(type) %>Layer extends Layer {
|
||||
initialize(layerId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId);
|
||||
|
||||
<% } else { -%>
|
||||
@@ -60,6 +63,7 @@ public class <%- camelize(type) %>Layer extends Layer {
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
@@ -201,16 +205,20 @@ public class <%- camelize(type) %>Layer extends Layer {
|
||||
<% } -%>
|
||||
|
||||
<% for (const property of properties) { -%>
|
||||
@Keep
|
||||
private native Object nativeGet<%- camelize(property.name) %>();
|
||||
|
||||
<% if (property.transition) { -%>
|
||||
@Keep
|
||||
private native TransitionOptions nativeGet<%- camelize(property.name) %>Transition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSet<%- camelize(property.name) %>Transition(long duration, long delay);
|
||||
|
||||
<% } -%>
|
||||
<% } -%>
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package com.mapbox.mapboxsdk.style.light;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
@@ -19,6 +20,7 @@ import com.mapbox.mapboxsdk.utils.ThreadUtils;
|
||||
@UiThread
|
||||
public class Light {
|
||||
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
|
||||
/**
|
||||
@@ -26,6 +28,7 @@ public class Light {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public Light(long nativePtr) {
|
||||
checkThread();
|
||||
this.nativePtr = nativePtr;
|
||||
@@ -185,18 +188,39 @@ public class Light {
|
||||
ThreadUtils.checkThread("Light");
|
||||
}
|
||||
|
||||
@Keep
|
||||
private native void nativeSetAnchor(String anchor);
|
||||
|
||||
@Keep
|
||||
private native String nativeGetAnchor();
|
||||
@Keep
|
||||
private native void nativeSetPosition(Position position);
|
||||
|
||||
@Keep
|
||||
private native Position nativeGetPosition();
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetPositionTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetPositionTransition(long duration, long delay);
|
||||
@Keep
|
||||
private native void nativeSetColor(String color);
|
||||
|
||||
@Keep
|
||||
private native String nativeGetColor();
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetColorTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetColorTransition(long duration, long delay);
|
||||
@Keep
|
||||
private native void nativeSetIntensity(float intensity);
|
||||
|
||||
@Keep
|
||||
private native float nativeGetIntensity();
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetIntensityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetIntensityTransition(long duration, long delay);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.style.light;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* Position of the light source relative to lit (extruded) geometries.
|
||||
* <p>
|
||||
@@ -13,8 +15,11 @@ package com.mapbox.mapboxsdk.style.light;
|
||||
*/
|
||||
public class Position {
|
||||
|
||||
@Keep
|
||||
private float radialCoordinate;
|
||||
@Keep
|
||||
private float azimuthalAngle;
|
||||
@Keep
|
||||
private float polarAngle;
|
||||
|
||||
/**
|
||||
@@ -38,6 +43,7 @@ public class Position {
|
||||
* @param polarAngle the polar angle
|
||||
* @return the created Position object
|
||||
*/
|
||||
@Keep
|
||||
public static Position fromPosition(float radialCoordinate, float azimuthalAngle, float polarAngle) {
|
||||
return new Position(radialCoordinate, azimuthalAngle, polarAngle);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
package com.mapbox.mapboxsdk.style.light;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
@@ -23,6 +24,7 @@ import com.mapbox.mapboxsdk.utils.ThreadUtils;
|
||||
@UiThread
|
||||
public class Light {
|
||||
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
|
||||
/**
|
||||
@@ -30,6 +32,7 @@ public class Light {
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
public Light(long nativePtr) {
|
||||
checkThread();
|
||||
this.nativePtr = nativePtr;
|
||||
@@ -120,14 +123,23 @@ public class Light {
|
||||
|
||||
<% for (const property of properties) { -%>
|
||||
<% if (property.name == "position") {-%>
|
||||
@Keep
|
||||
private native void nativeSet<%- camelize(property.name) %>(Position position);
|
||||
|
||||
@Keep
|
||||
private native Position nativeGet<%- camelize(property.name) %>();
|
||||
<% } else { -%>
|
||||
@Keep
|
||||
private native void nativeSet<%- camelize(property.name) %>(<%- propertyJavaType(property) -%> <%- property.name %>);
|
||||
|
||||
@Keep
|
||||
private native <%- propertyJavaType(property) -%> nativeGet<%- camelize(property.name) %>();
|
||||
<% } -%>
|
||||
<% if (property.transition) { -%>
|
||||
@Keep
|
||||
private native TransitionOptions nativeGet<%- camelize(property.name) %>Transition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSet<%- camelize(property.name) %>Transition(long duration, long delay);
|
||||
<% } -%>
|
||||
<% } -%>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
/**
|
||||
* Thrown when adding a source to a map twice
|
||||
*/
|
||||
@Keep
|
||||
public class CannotAddSourceException extends RuntimeException {
|
||||
|
||||
public CannotAddSourceException(String message) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -108,17 +109,23 @@ public class CustomGeometrySource extends Source {
|
||||
return features != null ? Arrays.asList(features) : new ArrayList<Feature>();
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String sourceId, Object options);
|
||||
|
||||
@Keep
|
||||
private native Feature[] querySourceFeatures(Object[] filter);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetTileData(int z, int x, int y, FeatureCollection data);
|
||||
|
||||
@Keep
|
||||
private native void nativeInvalidateTile(int z, int x, int y);
|
||||
|
||||
@Keep
|
||||
private native void nativeInvalidateBounds(LatLngBounds bounds);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
private void setTileData(TileID tileId, FeatureCollection data) {
|
||||
@@ -127,6 +134,7 @@ public class CustomGeometrySource extends Source {
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@Keep
|
||||
private void fetchTile(int z, int x, int y) {
|
||||
AtomicBoolean cancelFlag = new AtomicBoolean(false);
|
||||
TileID tileID = new TileID(z, x, y);
|
||||
@@ -136,6 +144,7 @@ public class CustomGeometrySource extends Source {
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@Keep
|
||||
private void cancelTile(int z, int x, int y) {
|
||||
AtomicBoolean cancelFlag = cancelledTileRequests.get(new TileID(z, x, y));
|
||||
if (cancelFlag != null) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -27,6 +28,7 @@ public class GeoJsonSource extends Source {
|
||||
*
|
||||
* @param nativePtr - pointer to native peer
|
||||
*/
|
||||
@Keep
|
||||
public GeoJsonSource(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -267,23 +269,32 @@ public class GeoJsonSource extends Source {
|
||||
return features != null ? Arrays.asList(features) : new ArrayList<Feature>();
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, Object options);
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetUrl(String url);
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetUrl();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetGeoJsonString(String geoJson);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFeatureCollection(FeatureCollection geoJson);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetFeature(Feature feature);
|
||||
|
||||
@Keep
|
||||
private native void nativeSetGeometry(Geometry geometry);
|
||||
|
||||
@Keep
|
||||
private native Feature[] querySourceFeatures(Object[] filter);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
@@ -33,6 +34,7 @@ public class ImageSource extends Source {
|
||||
*
|
||||
* @param nativePtr - pointer to native peer
|
||||
*/
|
||||
@Keep
|
||||
public ImageSource(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -141,16 +143,22 @@ public class ImageSource extends Source {
|
||||
nativeSetCoordinates(latLngQuad);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, LatLngQuad payload);
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetUrl(String url);
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetUrl();
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetImage(Bitmap bitmap);
|
||||
|
||||
@Keep
|
||||
protected native void nativeSetCoordinates(LatLngQuad latLngQuad);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
@@ -19,6 +20,7 @@ public class RasterDemSource extends Source {
|
||||
*
|
||||
* @param nativePtr - pointer to native peer
|
||||
*/
|
||||
@Keep
|
||||
private RasterDemSource(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -88,11 +90,14 @@ public class RasterDemSource extends Source {
|
||||
return nativeGetUrl();
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, Object payload, int tileSize);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetUrl();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.net.URL;
|
||||
@@ -17,6 +18,7 @@ public class RasterSource extends Source {
|
||||
*
|
||||
* @param nativePtr - pointer to native peer
|
||||
*/
|
||||
@Keep
|
||||
public RasterSource(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -87,11 +89,14 @@ public class RasterSource extends Source {
|
||||
return nativeGetUrl();
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, Object payload, int tileSize);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetUrl();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
import com.mapbox.mapboxsdk.utils.ThreadUtils;
|
||||
|
||||
/**
|
||||
@@ -7,6 +9,7 @@ import com.mapbox.mapboxsdk.utils.ThreadUtils;
|
||||
*/
|
||||
public abstract class Source {
|
||||
|
||||
@Keep
|
||||
private long nativePtr;
|
||||
|
||||
/**
|
||||
@@ -14,6 +17,7 @@ public abstract class Source {
|
||||
*
|
||||
* @param nativePtr - pointer to native peer
|
||||
*/
|
||||
@Keep
|
||||
public Source(long nativePtr) {
|
||||
checkThread();
|
||||
this.nativePtr = nativePtr;
|
||||
@@ -62,7 +66,9 @@ public abstract class Source {
|
||||
return nativePtr;
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetId();
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetAttribution();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
/**
|
||||
* An unknown type of source
|
||||
*/
|
||||
@UiThread
|
||||
@Keep
|
||||
public class UnknownSource extends Source {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mapbox.mapboxsdk.style.sources;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.Size;
|
||||
@@ -26,6 +27,7 @@ public class VectorSource extends Source {
|
||||
*
|
||||
* @param nativePtr - pointer to native peer
|
||||
*/
|
||||
@Keep
|
||||
public VectorSource(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
@@ -88,13 +90,17 @@ public class VectorSource extends Source {
|
||||
return nativeGetUrl();
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, Object payload);
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
@Keep
|
||||
protected native String nativeGetUrl();
|
||||
|
||||
@Keep
|
||||
private native Feature[] querySourceFeatures(String[] sourceLayerId,
|
||||
Object[] filter);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.WorkerThread;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ public class LocalGlyphRasterizer {
|
||||
* @return Return a {@link Bitmap} to be displayed in the requested tile.
|
||||
*/
|
||||
@WorkerThread
|
||||
@Keep
|
||||
protected static Bitmap drawGlyphBitmap(String fontFamily, boolean bold, char glyphID) {
|
||||
/*
|
||||
35x35px dimensions are hardwired to match local_glyph_rasterizer.cpp
|
||||
|
||||
1
platform/android/MapboxGLAndroidSDKLint/.gitignore
vendored
Normal file
1
platform/android/MapboxGLAndroidSDKLint/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
37
platform/android/MapboxGLAndroidSDKLint/build.gradle
Normal file
37
platform/android/MapboxGLAndroidSDKLint/build.gradle
Normal file
@@ -0,0 +1,37 @@
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compileOnly dependenciesList.kotlinLib
|
||||
|
||||
compileOnly dependenciesList.lint
|
||||
compileOnly dependenciesList.lintApi
|
||||
compileOnly dependenciesList.lintChecks
|
||||
compileOnly dependenciesList.supportAnnotations
|
||||
|
||||
testImplementation dependenciesList.junit
|
||||
testImplementation dependenciesList.robolectric
|
||||
testImplementation dependenciesList.lintTests
|
||||
}
|
||||
|
||||
sourceCompatibility = "1.8"
|
||||
targetCompatibility = "1.8"
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes("Lint-Registry-v2": "com.mapbox.mapboxsdk.lint.MapboxIssueRegistry")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mapbox.mapboxsdk.lint
|
||||
|
||||
import com.android.tools.lint.client.api.UElementHandler
|
||||
import com.android.tools.lint.detector.api.*
|
||||
import com.intellij.lang.jvm.JvmModifier
|
||||
import com.intellij.psi.PsiType
|
||||
import org.jetbrains.uast.*
|
||||
|
||||
class KeepDetector : Detector(), SourceCodeScanner, FileScanner {
|
||||
companion object {
|
||||
private val DETECTOR_CLASS = KeepDetector::class.java
|
||||
private val DETECTOR_SCOPE = Scope.JAVA_FILE_SCOPE
|
||||
private val IMPLEMENTATION = Implementation(DETECTOR_CLASS, DETECTOR_SCOPE)
|
||||
|
||||
private const val ISSUE_ID = "KeepMissing"
|
||||
private const val ISSUE_DESCRIPTION = "Element cannot be minified."
|
||||
private const val ISSUE_EXPLANATION = "This class, method or field might contain native references. " +
|
||||
"It has to be annotated with @Keep if it cannot be obfuscated/removed, otherwise, the warning should be suppressed. " +
|
||||
"There can also be another methods/fields of this class that cannot be obfuscated/removed, " +
|
||||
"look closely for any methods that are referenced from the JNI context."
|
||||
private val ISSUE_CATEGORY = Category.CORRECTNESS
|
||||
private const val ISSUE_PRIORITY = 9
|
||||
private val ISSUE_SEVERITY = Severity.ERROR
|
||||
|
||||
var ISSUE_NOT_KEPT = Issue.create(
|
||||
ISSUE_ID,
|
||||
ISSUE_DESCRIPTION,
|
||||
ISSUE_EXPLANATION,
|
||||
ISSUE_CATEGORY,
|
||||
ISSUE_PRIORITY,
|
||||
ISSUE_SEVERITY,
|
||||
IMPLEMENTATION
|
||||
)
|
||||
}
|
||||
|
||||
override fun getApplicableUastTypes(): List<Class<out UElement>>? =
|
||||
listOf(UMethod::class.java, UField::class.java)
|
||||
|
||||
override fun createUastHandler(context: JavaContext): UElementHandler? = KeepHandler(context)
|
||||
|
||||
class KeepHandler(private val context: JavaContext) : UElementHandler() {
|
||||
|
||||
override fun visitMethod(node: UMethod) {
|
||||
if (node.hasModifier(JvmModifier.NATIVE) && checkKeepAnnotation(node)) {
|
||||
context.report(ISSUE_NOT_KEPT, node,
|
||||
context.getNameLocation(node),
|
||||
"This method contains native references and will be minified.")
|
||||
} else if (node.isConstructor
|
||||
&& node.parameterList.parameters.find { it.type == PsiType.LONG && it.name!!.contains("native") } != null
|
||||
&& checkKeepAnnotation(node)) {
|
||||
context.report(ISSUE_NOT_KEPT, node,
|
||||
context.getNameLocation(node as UElement),
|
||||
"This constructor might contain native references and will be minified. " +
|
||||
"Either suppress the warning or use @Keep.")
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitField(node: UField) {
|
||||
if (node.type == PsiType.LONG && node.name.contains("native") && checkKeepAnnotation(node)) {
|
||||
context.report(ISSUE_NOT_KEPT, node,
|
||||
context.getNameLocation(node as UElement),
|
||||
"This field might contain native references and will be minified. " +
|
||||
"Either suppress the warning or use @Keep.")
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkKeepAnnotation(uAnnotated: UAnnotated): Boolean {
|
||||
return !hasKeepAnnotation(uAnnotated) && !hasKeepAnnotation(uAnnotated.getContainingUClass()!!)
|
||||
}
|
||||
|
||||
private fun hasKeepAnnotation(uAnnotated: UAnnotated): Boolean {
|
||||
return uAnnotated.findAnnotation("android.support.annotation.Keep") != null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mapbox.mapboxsdk.lint
|
||||
|
||||
import com.android.tools.lint.client.api.IssueRegistry
|
||||
import com.android.tools.lint.detector.api.Issue
|
||||
|
||||
class MapboxIssueRegistry : IssueRegistry() {
|
||||
override val issues: List<Issue>
|
||||
get() = listOf(KeepDetector.ISSUE_NOT_KEPT)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mapbox.mapboxsdk.lint
|
||||
|
||||
import com.android.tools.lint.checks.infrastructure.TestFiles.java
|
||||
import com.android.tools.lint.checks.infrastructure.TestLintTask.lint
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class KeepDetectorTest {
|
||||
|
||||
@Test
|
||||
fun correctClassName() {
|
||||
lint()
|
||||
.allowMissingSdk()
|
||||
.files(java("""
|
||||
|package foo;
|
||||
|
|
||||
|import android.support.annotation.Keep;
|
||||
|
|
||||
|@Keep
|
||||
|class TestClass {
|
||||
|}""".trimMargin()))
|
||||
.issues(KeepDetector.ISSUE_NOT_KEPT)
|
||||
.run()
|
||||
.expectClean()
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.mapbox.mapboxsdk.testapp.model.customlayer;
|
||||
|
||||
import android.support.annotation.Keep;
|
||||
|
||||
@Keep
|
||||
public class ExampleCustomLayer {
|
||||
static {
|
||||
System.loadLibrary("example-custom-layer");
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<string name="dynamic_marker_arsenal_title">Arsenal</string>
|
||||
<string name="dynamic_marker_arsenal_snippet">Emirates Stadium</string>
|
||||
<string name="debug_zoom">Zoom: %.2f</string>
|
||||
<string name="viewcache_size">ViewCache size %.2f</string>
|
||||
<string name="viewcache_size">ViewCache size %d</string>
|
||||
<string name="latitude">Latitude</string>
|
||||
<string name="min_value">-180</string>
|
||||
<string name="longitude">Longitude</string>
|
||||
|
||||
@@ -21,7 +21,8 @@ ext {
|
||||
timber : '4.7.1',
|
||||
okhttp : '3.11.0',
|
||||
kotlin : '1.2.51',
|
||||
licenses : '0.8.41'
|
||||
licenses : '0.8.41',
|
||||
lint : '26.1.3'
|
||||
]
|
||||
|
||||
dependenciesList = [
|
||||
@@ -57,6 +58,11 @@ ext {
|
||||
|
||||
kotlinLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
|
||||
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
|
||||
licensesPlugin : "com.jaredsburrows:gradle-license-plugin:${versions.licenses}"
|
||||
licensesPlugin : "com.jaredsburrows:gradle-license-plugin:${versions.licenses}",
|
||||
|
||||
lint : "com.android.tools.lint:lint:${versions.lint}",
|
||||
lintApi : "com.android.tools.lint:lint-api:${versions.lint}",
|
||||
lintChecks : "com.android.tools.lint:lint-checks:${versions.lint}",
|
||||
lintTests : "com.android.tools.lint:lint-tests:${versions.lint}"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
include ':MapboxGLAndroidSDK', ':MapboxGLAndroidSDKTestApp'
|
||||
include ':MapboxGLAndroidSDK', ':MapboxGLAndroidSDKTestApp', ':MapboxGLAndroidSDKLint'
|
||||
Reference in New Issue
Block a user