diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-11-20 15:22:34 +0200 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-11-20 17:30:24 +0200 |
commit | 7dabec61b6b66781feade474e1092086596790f2 (patch) | |
tree | e5cbf963d0f7c624fa8a3b7234fb68ad84e8deb4 | |
parent | 25cfb5863c9ac3705d2bcf4086c237608264e3ae (diff) | |
download | qtlocation-mapboxgl-7dabec61b6b66781feade474e1092086596790f2.tar.gz |
[android] Enable map rendering when app is paused
4 files changed, 21 insertions, 4 deletions
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 c025a119b7..beb51d7b68 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 @@ -365,6 +365,10 @@ public class MapView extends FrameLayout { if (mapboxMap != null) { mapboxMap.onStart(); } + + if (mapRenderer != null) { + mapRenderer.onStart(); + } } /** @@ -396,6 +400,11 @@ public class MapView extends FrameLayout { // map was destroyed before it was started mapboxMap.onStop(); } + + if (mapRenderer != null) { + mapRenderer.onStop(); + } + ConnectivityReceiver.instance(getContext()).deactivate(); FileSource.getInstance(getContext()).deactivate(); } 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 961438ed14..2baff473e9 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 @@ -33,6 +33,10 @@ public abstract class MapRenderer implements MapRendererScheduler { nativeInitialize(this, fileSource, pixelRatio, programCacheDir); } + public void onStart() { + // Implement if needed + } + public void onPause() { // Implement if needed } @@ -41,6 +45,10 @@ public abstract class MapRenderer implements MapRendererScheduler { // Implement if needed } + public void onStop() { + // Implement if needed + } + public void onDestroy() { // Implement if needed } 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 ba2e118faa..d98e4d06a3 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 @@ -31,12 +31,12 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi } @Override - public void onPause() { + public void onStop() { glSurfaceView.onPause(); } @Override - public void onResume() { + public void onStart() { glSurfaceView.onResume(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java index 8cd724a828..397904b1f5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java @@ -74,7 +74,7 @@ public class TextureViewMapRenderer extends MapRenderer { * {@inheritDoc} */ @Override - public void onPause() { + public void onStop() { renderThread.onPause(); } @@ -82,7 +82,7 @@ public class TextureViewMapRenderer extends MapRenderer { * {@inheritDoc} */ @Override - public void onResume() { + public void onStart() { renderThread.onResume(); } |