This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] reset the native renderer only when the GL thread exits
- Loading branch information
1 parent
f9796d2
commit 409ead6
Showing
7 changed files
with
81 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...K/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/MapboxGLSurfaceView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.mapbox.mapboxsdk.maps.renderer.glsurfaceview; | ||
|
||
import android.content.Context; | ||
import android.opengl.GLSurfaceView; | ||
import android.support.annotation.NonNull; | ||
import android.util.AttributeSet; | ||
|
||
/** | ||
* {@link GLSurfaceView} extension that notifies a listener when the view is detached from window, | ||
* which is the point of destruction of the GL thread. | ||
*/ | ||
public class MapboxGLSurfaceView extends GLSurfaceView { | ||
|
||
private OnGLSurfaceViewDetachedListener detachedListener; | ||
|
||
public MapboxGLSurfaceView(Context context) { | ||
super(context); | ||
} | ||
|
||
public MapboxGLSurfaceView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
@Override | ||
protected void onDetachedFromWindow() { | ||
if (detachedListener != null) { | ||
detachedListener.onGLSurfaceViewDetached(); | ||
} | ||
super.onDetachedFromWindow(); | ||
} | ||
|
||
/** | ||
* Set a listener that gets notified when the view is detached from window. | ||
* | ||
* @param detachedListener listener | ||
*/ | ||
public void setDetachedListener(@NonNull OnGLSurfaceViewDetachedListener detachedListener) { | ||
if (this.detachedListener != null) { | ||
throw new IllegalArgumentException("Detached from window listener has been already set."); | ||
} | ||
this.detachedListener = detachedListener; | ||
} | ||
|
||
/** | ||
* Listener interface that notifies when a {@link MapboxGLSurfaceView} is detached from window. | ||
*/ | ||
public interface OnGLSurfaceViewDetachedListener { | ||
|
||
/** | ||
* Called when a {@link MapboxGLSurfaceView} is detached from window. | ||
*/ | ||
void onGLSurfaceViewDetached(); | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
...n/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/SurfaceHolderCallbackAdapter.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters