diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2018-07-24 00:20:02 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-07-26 19:47:11 +0200 |
commit | 94ad8e2ff8928bec316dfcc9790db7b522673d3e (patch) | |
tree | 1a7b0c7fb42aa6dba049c5d42305f6d5c4ac93b7 /platform/android/MapboxGLAndroidSDK/src/main | |
parent | 5fcd6e38a9e9ca755d997b83f007f8a2f435cf45 (diff) | |
download | qtlocation-mapboxgl-94ad8e2ff8928bec316dfcc9790db7b522673d3e.tar.gz |
[android] using @Keep annotation across the project with the help of lint checks
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main')
55 files changed, 641 insertions, 10 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BasePointCollection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BasePointCollection.java index e57821b541..4fee9443d7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BasePointCollection.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BasePointCollection.java @@ -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() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java index 18f74cd990..dad3d61f0c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java index dd2c37762a..b45c32cdae 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java @@ -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() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java index 6cea29ef81..41a6ef3536 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java @@ -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() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java index e732b2525f..7375abc359 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java index 79023e2fd9..57c83daf18 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLng.java @@ -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); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java index d234250770..3a21f9d124 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngQuad.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngQuad.java index e374eee8f3..9f65ee636b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngQuad.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngQuad.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java index fa84c33b2b..7251fd360b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/ProjectedMeters.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index e0c63944b9..9e3056bf8e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -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); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Image.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Image.java index 80f1271266..a261c2f4b1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Image.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Image.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 64ad0d29b3..0719412b4c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -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> { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 31910b206e..dcd6e54cbe 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -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() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java index fcee5bd179..b05a8a407f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java @@ -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 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererRunnable.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererRunnable.java index 28246fe578..2ec82ea202 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererRunnable.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererRunnable.java @@ -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 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererScheduler.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererScheduler.java index 7ad4f124d8..fd12cceee6 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererScheduler.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRendererScheduler.java @@ -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); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java index 7bc56475c0..b0667751bb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java @@ -77,5 +77,4 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi glSurfaceView.queueEvent(runnable); } - -} +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/NativeConnectivityListener.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/NativeConnectivityListener.java index ae74859228..491013e874 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/NativeConnectivityListener.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/NativeConnectivityListener.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java index f2faabd63b..dbf425986d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java @@ -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); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java index 946d3694d5..d4335d1d7a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegion.java @@ -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); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java index 18d662a286..d1b18445fa 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java @@ -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(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionError.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionError.java index 83f3c06d68..c6f328d533 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionError.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionError.java @@ -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; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java index 0f4b81fc39..1fd60de79d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionStatus.java @@ -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, diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java index ea9a066df7..b0d12859ed 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java @@ -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 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java index 0dbf977e4e..f3acf829bf 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshot.java @@ -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(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java index a2c7ed5dfd..2aea565d8b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java @@ -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 { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java index 929e4b4279..c8d02c05d9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java index 0a0c3f1e43..ddb4d04fff 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CannotAddLayerException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CannotAddLayerException.java index 212493032d..783f9e9024 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CannotAddLayerException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CannotAddLayerException.java @@ -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) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java index c85cfba0a5..8abd78ace2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java index a0ba1e2159..79b68bbfc0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CustomLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java index fdfc8c51a9..6efe04e39d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java index b51c49e517..aaa20d6f3a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java index d28e4bd838..6d7cece124 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java index 75a2607b05..f906104e91 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java index 3edc202c8e..92aa54e55f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java @@ -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() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java index b094162c4b..4a742cd7a6 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java index 1214f7b11c..83e228cba0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java index 4aefad3956..f2ddb600a5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java index 6e6e4ca613..2a25302aed 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java @@ -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); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/UnknownLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/UnknownLayer.java index 4abafcdbeb..b9898e72da 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/UnknownLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/UnknownLayer.java @@ -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 { /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs index 21b0a1d59e..2d4db2b55d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java index 411c4c9652..c0cf33e150 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java @@ -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); }
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java index 00f8486a1c..efd92f65a4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java @@ -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); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs index f3e7c31a4f..59b07d32d4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs @@ -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); <% } -%> <% } -%> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CannotAddSourceException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CannotAddSourceException.java index ddc4c58cf1..a418cb61a9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CannotAddSourceException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CannotAddSourceException.java @@ -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) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java index 469bfa8f39..1f6029e2a2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java @@ -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) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java index 9ecc70e123..33d8ba03ee 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java index 2faf0d67ae..d84105a05c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/ImageSource.java @@ -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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java index 0c510f7594..dc3635ca86 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java @@ -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(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java index f1f4cc1ff1..6bd0456e0c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java @@ -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(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java index 6a0939569a..53c8148580 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/Source.java @@ -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(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/UnknownSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/UnknownSource.java index 4a97d71f9a..8135b055db 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/UnknownSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/UnknownSource.java @@ -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 { /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java index 0df17572e9..393d8c2b81 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java @@ -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); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/LocalGlyphRasterizer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/LocalGlyphRasterizer.java index 181d28191a..5904c0d69e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/LocalGlyphRasterizer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/LocalGlyphRasterizer.java @@ -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 |