[map] expose getter for the view used for rendering OpenGL on (#87)

This commit is contained in:
Tobrun
2019-12-03 21:00:37 +01:00
committed by GitHub
parent e8678922e4
commit c51eab4001
3 changed files with 70 additions and 0 deletions

View File

@@ -70,6 +70,8 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
private NativeMap nativeMapView;
@Nullable
private MapboxMap mapboxMap;
private View renderView;
private AttributionClickListener attributionClickListener;
private MapboxMapOptions mapboxMapOptions;
private MapRenderer mapRenderer;
@@ -296,6 +298,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
};
addView(textureView, 0);
renderView = textureView;
} else {
MapboxGLSurfaceView glSurfaceView = new MapboxGLSurfaceView(getContext());
glSurfaceView.setZOrderMediaOverlay(mapboxMapOptions.getRenderSurfaceOnTop());
@@ -308,6 +311,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
};
addView(glSurfaceView, 0);
renderView = glSurfaceView;
}
boolean crossSourceCollisions = mapboxMapOptions.getCrossSourceCollisions();
@@ -465,6 +469,20 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
return destroyed;
}
/**
* Returns the View used for rendering OpenGL.
* <p>
* The type of the returned view is either a GLSurfaceView or a TextureView.
* </p>
*
* @return the view used for rendering OpenGL
*/
@NonNull
@UiThread
public View getRenderView() {
return renderView;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (!isGestureDetectorInitialized()) {