diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-10-31 18:12:04 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2017-11-03 09:19:39 -0700 |
commit | 3b2bd7ce4f7087f51f2aeace22fe60c5c83ee1d9 (patch) | |
tree | 6e7b25bca673728a432e1ec6ee10a86a5d7d40fb /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | |
parent | e9bb4d1582dafcb4ca87bdfc6bb58bac2d405954 (diff) | |
download | qtlocation-mapboxgl-3b2bd7ce4f7087f51f2aeace22fe60c5c83ee1d9.tar.gz |
[android] bring back texture view
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 7b979f5563..f26e0b9d3b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -85,6 +85,8 @@ public class MapboxMapOptions implements Parcelable { private String apiBaseUrl; + private boolean textureMode; + private String style; /** @@ -152,7 +154,7 @@ public class MapboxMapOptions implements Parcelable { style = in.readString(); apiBaseUrl = in.readString(); - + textureMode = in.readByte() != 0; prefetchesTiles = in.readByte() != 0; zMediaOverlay = in.readByte() != 0; } @@ -296,6 +298,8 @@ public class MapboxMapOptions implements Parcelable { ColorUtils.getPrimaryColor(context))); mapboxMapOptions.myLocationAccuracyThreshold( typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_myLocationAccuracyThreshold, 0)); + mapboxMapOptions.textureMode( + typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_renderTextureMode, false)); mapboxMapOptions.setPrefetchesTiles( typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableTilePrefetch, true)); mapboxMapOptions.renderSurfaceOnTop( @@ -699,12 +703,29 @@ public class MapboxMapOptions implements Parcelable { } /** + * Enable {@link android.view.TextureView} as rendered surface. + * <p> + * Since the 5.2.0 release we replaced our TextureView with an {@link android.opengl.GLSurfaceView} + * implementation. Enabling this option will use the {@link android.view.TextureView} instead. + * {@link android.view.TextureView} can be useful in situations where you need to animate, scale + * or transform the view. This comes at a siginficant performance penalty and should not be considered + * unless absolutely needed. + * </p> + * + * @param textureMode True to enable texture mode + * @return This + */ + public MapboxMapOptions textureMode(boolean textureMode) { + this.textureMode = textureMode; + return this; + } + + /** * Enable tile pre-fetching. Loads tiles at a lower zoom-level to pre-render * a low resolution preview while more detailed tiles are loaded. * Enabled by default * * @param enable true to enable - * * @return This */ public MapboxMapOptions setPrefetchesTiles(boolean enable) { @@ -1049,6 +1070,15 @@ public class MapboxMapOptions implements Parcelable { return debugActive; } + /** + * Returns true if TextureView is being used the render view. + * + * @return True if TextureView is used. + */ + public boolean getTextureMode() { + return textureMode; + } + public static final Parcelable.Creator<MapboxMapOptions> CREATOR = new Parcelable.Creator<MapboxMapOptions>() { public MapboxMapOptions createFromParcel(Parcel in) { return new MapboxMapOptions(in); @@ -1112,7 +1142,7 @@ public class MapboxMapOptions implements Parcelable { dest.writeString(style); dest.writeString(apiBaseUrl); - + dest.writeByte((byte) (textureMode ? 1 : 0)); dest.writeByte((byte) (prefetchesTiles ? 1 : 0)); dest.writeByte((byte) (zMediaOverlay ? 1 : 0)); } @@ -1289,6 +1319,7 @@ public class MapboxMapOptions implements Parcelable { result = 31 * result + (myLocationAccuracyThreshold != +0.0f ? Float.floatToIntBits(myLocationAccuracyThreshold) : 0); result = 31 * result + (apiBaseUrl != null ? apiBaseUrl.hashCode() : 0); + result = 31 * result + (textureMode ? 1 : 0); result = 31 * result + (style != null ? style.hashCode() : 0); result = 31 * result + (prefetchesTiles ? 1 : 0); result = 31 * result + (zMediaOverlay ? 1 : 0); |