summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2019-03-15 14:06:59 +0100
committerTobrun <tobrun@mapbox.com>2019-03-22 18:39:29 +0100
commitab5f935b57db7255d1ca939c296f2d869a56a3cc (patch)
treec2d839f6e04df8ce36e29adb55cb21e2fe1adc20
parent76df7d9cee6968e7e620f2f915254084f82d94ec (diff)
downloadqtlocation-mapboxgl-ab5f935b57db7255d1ca939c296f2d869a56a3cc.tar.gz
[android] - hook GLSurfaceViewMapRenderer into surfaceCreated callback, don't destroy map renderer when surface is destroyed as it can be recreated later
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java13
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java1
2 files changed, 5 insertions, 9 deletions
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 9d9a7bd2d4..6eeb148283 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
@@ -2,10 +2,8 @@ package com.mapbox.mapboxsdk.maps.renderer.glsurfaceview;
import android.content.Context;
import android.opengl.GLSurfaceView;
-
import android.support.annotation.NonNull;
import android.view.SurfaceHolder;
-
import com.mapbox.mapboxsdk.maps.renderer.MapRenderer;
import com.mapbox.mapboxsdk.maps.renderer.egl.EGLConfigChooser;
@@ -25,8 +23,6 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi
@NonNull
private final GLSurfaceView glSurfaceView;
- private boolean requestDestroy;
-
public GLSurfaceViewMapRenderer(Context context,
GLSurfaceView glSurfaceView,
String localIdeographFontFamily) {
@@ -42,9 +38,13 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
- requestDestroy = true;
+ onSurfaceDestroyed();
}
+ @Override
+ public void surfaceCreated(SurfaceHolder holder) {
+ onSurfaceCreated(null, null);
+ }
});
}
@@ -60,9 +60,6 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi
@Override
public void onDestroy() {
- if (requestDestroy) {
- onSurfaceDestroyed();
- }
super.onDestroy();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java
index 96d5e9e943..165b15a512 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java
@@ -197,7 +197,6 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu
if (destroySurface) {
eglHolder.destroySurface();
destroySurface = false;
- mapRenderer.onSurfaceDestroyed();
break;
}