diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK')
5 files changed, 38 insertions, 5 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/gradle.properties b/platform/android/MapboxGLAndroidSDK/gradle.properties index 078fdbc801..ff6e2f61df 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle.properties +++ b/platform/android/MapboxGLAndroidSDK/gradle.properties @@ -17,4 +17,4 @@ POM_PACKAGING=aar # Only build native dependencies for the current ABI # See https://code.google.com/p/android/issues/detail?id=221098#c20 -android.buildOnlyTargetAbi=true +android.buildOnlyTargetAbi=true
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 1f31e3b5a3..848a898f94 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -133,7 +133,7 @@ public class MapView extends FrameLayout { } else { getViewTreeObserver().removeGlobalOnLayoutListener(this); } - initialiseDrawingSurface(mapboxMapOptions.getTextureMode()); + initialiseDrawingSurface(mapboxMapOptions); } }); } @@ -229,13 +229,14 @@ public class MapView extends FrameLayout { } } - private void initialiseDrawingSurface(boolean textureMode) { - if (textureMode) { + private void initialiseDrawingSurface(MapboxMapOptions mapboxMapOptions) { + if (mapboxMapOptions.getTextureMode()) { TextureView textureView = new TextureView(getContext()); textureView.setSurfaceTextureListener(new SurfaceTextureListener()); addView(textureView, 0); } else { SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView); + surfaceView.setZOrderMediaOverlay(mapboxMapOptions.getRenderSurfaceOnTop()); surfaceView.getHolder().addCallback(new SurfaceCallback()); surfaceView.setVisibility(View.VISIBLE); } 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 4301d64375..94e2fbcf3b 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 @@ -81,6 +81,7 @@ public class MapboxMapOptions implements Parcelable { private int myLocationAccuracyAlpha; private float myLocationAccuracyThreshold; private boolean prefetchesTiles = true; + private boolean zMediaOverlay = false; private String apiBaseUrl; @@ -156,6 +157,7 @@ public class MapboxMapOptions implements Parcelable { apiBaseUrl = in.readString(); textureMode = in.readByte() != 0; prefetchesTiles = in.readByte() != 0; + zMediaOverlay = in.readByte() != 0; } static Bitmap getBitmapFromDrawable(Drawable drawable) { @@ -301,6 +303,8 @@ public class MapboxMapOptions implements Parcelable { typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_renderTextureMode, false)); mapboxMapOptions.setPrefetchesTiles( typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableTilePrefetch, true)); + mapboxMapOptions.renderSurfaceOnTop( + typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableZMediaOverlay, false)); } finally { typedArray.recycle(); } @@ -718,7 +722,6 @@ public class MapboxMapOptions implements Parcelable { /** * 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 @@ -739,6 +742,25 @@ public class MapboxMapOptions implements Parcelable { return prefetchesTiles; } + + /** + * Set the flag to render the map surface on top of another surface. + * + * @param renderOnTop true if this map is shown on top of another one, false if bottom. + */ + public void renderSurfaceOnTop(boolean renderOnTop) { + this.zMediaOverlay = renderOnTop; + } + + /** + * Get the flag to render the map surface on top of another surface. + * + * @return true if this map is + */ + public boolean getRenderSurfaceOnTop() { + return zMediaOverlay; + } + /** * Get the current configured API endpoint base URL. * @@ -1123,6 +1145,7 @@ public class MapboxMapOptions implements Parcelable { dest.writeString(apiBaseUrl); dest.writeByte((byte) (textureMode ? 1 : 0)); dest.writeByte((byte) (prefetchesTiles ? 1 : 0)); + dest.writeByte((byte) (zMediaOverlay ? 1 : 0)); } @Override @@ -1249,6 +1272,10 @@ public class MapboxMapOptions implements Parcelable { if (prefetchesTiles != options.prefetchesTiles) { return false; } + if (zMediaOverlay != options.zMediaOverlay) { + return false; + } + return false; } @@ -1296,6 +1323,7 @@ public class MapboxMapOptions implements Parcelable { 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); return result; } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml index f30cb7c27a..3decd6ead1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml @@ -75,6 +75,9 @@ <!-- Deprecated to use TextureView--> <public name="mapbox_renderTextureMode" type="attr" /> + <public name="mapbox_enableTilePrefetch" type="attr" /> + <public name="mapbox_enableZMediaOverlay" type="attr" /> + <!-- Exposed content descriptions --> <public name="mapbox_logoContentDescription" type="string" /> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml index a7ef78d699..281fe8afe3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml @@ -118,6 +118,7 @@ <attr name="mapbox_renderTextureMode" format="boolean"/> <attr name="mapbox_enableTilePrefetch" format="boolean"/> + <attr name="mapbox_enableZMediaOverlay" format="boolean"/> </declare-styleable> |