diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2017-10-27 15:57:35 -0700 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2017-11-01 14:56:37 -0700 |
commit | cb7f6dfaec2f90a81d588c2458e01d2a191f9ba1 (patch) | |
tree | eeb4d9847940c571f5a03ae4e52f32fd776451be /platform/android/MapboxGLAndroidSDK/src/main | |
parent | e5243b7691831e194ccb1638d33b8d4dd94f4d9c (diff) | |
download | qtlocation-mapboxgl-cb7f6dfaec2f90a81d588c2458e01d2a191f9ba1.tar.gz |
[android] - make snapshot logo optional
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main')
2 files changed, 25 insertions, 4 deletions
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 aefa962402..eb4f94c428 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 @@ -15,14 +15,16 @@ public class MapSnapshot { private long nativePtr = 0; private Bitmap bitmap; private String[] attributions; + private boolean showLogo; /** * Created from native side */ - private MapSnapshot(long nativePtr, Bitmap bitmap, String[] attributions) { + private MapSnapshot(long nativePtr, Bitmap bitmap, String[] attributions, boolean showLogo) { this.nativePtr = nativePtr; this.bitmap = bitmap; this.attributions = attributions; + this.showLogo = showLogo; } /** @@ -47,6 +49,13 @@ public class MapSnapshot { return attributions; } + /** + * @return Flag indicating to show the Mapbox logo. + */ + boolean isShowLogo() { + return showLogo; + } + // Unused, needed for peer binding private native void initialize(); 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 37d05fc328..00fa0171cd 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 @@ -74,6 +74,7 @@ public class MapSnapshotter { private String styleUrl = Style.MAPBOX_STREETS; private LatLngBounds region; private CameraPosition cameraPosition; + private boolean showLogo = true; /** * @param width the width of the image @@ -124,6 +125,15 @@ public class MapSnapshotter { } /** + * @param showLogo The flag indicating to show the Mapbox logo. + * @return the mutated {@link Options} + */ + public Options withLogo(boolean showLogo) { + this.showLogo = showLogo; + return this; + } + + /** * @return the width of the image */ public int getWidth() { @@ -182,7 +192,7 @@ public class MapSnapshotter { nativeInitialize(this, fileSource, options.pixelRatio, options.width, options.height, options.styleUrl, options.region, options.cameraPosition, - programCacheDir); + options.showLogo, programCacheDir); } /** @@ -266,7 +276,9 @@ public class MapSnapshotter { */ protected void onSnapshotReady(MapSnapshot snapshot) { if (callback != null) { - addOverlay(snapshot.getBitmap()); + if (snapshot.isShowLogo()) { + addOverlay(snapshot.getBitmap()); + } callback.onSnapshotReady(snapshot); reset(); } @@ -294,7 +306,7 @@ public class MapSnapshotter { FileSource fileSource, float pixelRatio, int width, int height, String styleUrl, LatLngBounds region, CameraPosition position, - String programCacheDir); + boolean showLogo, String programCacheDir); protected native void nativeStart(); |