Merge tag 'ios-v3.7.4' into master
# Conflicts: # include/mbgl/style/conversion/tileset.hpp # include/mbgl/util/tileset.hpp # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java # platform/ios/CHANGELOG.md # platform/ios/ios.xcodeproj/project.pbxproj # platform/macos/CHANGELOG.md # src/mbgl/layout/symbol_projection.cpp # src/mbgl/renderer/tile_pyramid.cpp # src/mbgl/style/conversion/tileset.cpp
This commit is contained in:
@@ -42,18 +42,16 @@ import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings;
|
||||
import com.mapbox.mapboxsdk.net.ConnectivityReceiver;
|
||||
import com.mapbox.mapboxsdk.storage.FileSource;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION;
|
||||
import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_WAIT_IDLE;
|
||||
|
||||
@@ -137,17 +135,7 @@ public class MapView extends FrameLayout {
|
||||
setContentDescription(context.getString(R.string.mapbox_mapActionDescription));
|
||||
setWillNotDraw(false);
|
||||
|
||||
getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
} else {
|
||||
getViewTreeObserver().removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
initialiseDrawingSurface(options);
|
||||
}
|
||||
});
|
||||
getViewTreeObserver().addOnGlobalLayoutListener(new MapViewLayoutListener(this, options));
|
||||
}
|
||||
|
||||
private void initialiseMap() {
|
||||
@@ -313,7 +301,7 @@ public class MapView extends FrameLayout {
|
||||
|
||||
addView(textureView, 0);
|
||||
} else {
|
||||
GLSurfaceView glSurfaceView = (GLSurfaceView) findViewById(R.id.surfaceView);
|
||||
GLSurfaceView glSurfaceView = new GLSurfaceView(getContext());
|
||||
glSurfaceView.setZOrderMediaOverlay(mapboxMapOptions.getRenderSurfaceOnTop());
|
||||
mapRenderer = new GLSurfaceViewMapRenderer(getContext(), glSurfaceView, options.getLocalIdeographFontFamily()) {
|
||||
@Override
|
||||
@@ -323,7 +311,7 @@ public class MapView extends FrameLayout {
|
||||
}
|
||||
};
|
||||
|
||||
glSurfaceView.setVisibility(View.VISIBLE);
|
||||
addView(glSurfaceView, 0);
|
||||
}
|
||||
|
||||
nativeMapView = new NativeMapView(this, mapRenderer);
|
||||
@@ -890,6 +878,30 @@ public class MapView extends FrameLayout {
|
||||
void onMapChanged(@MapChange int change);
|
||||
}
|
||||
|
||||
private static class MapViewLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
|
||||
|
||||
private WeakReference<MapView> mapViewWeakReference;
|
||||
private MapboxMapOptions options;
|
||||
|
||||
MapViewLayoutListener(MapView mapView, MapboxMapOptions options) {
|
||||
this.mapViewWeakReference = new WeakReference<>(mapView);
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
MapView mapView = mapViewWeakReference.get();
|
||||
if (mapView != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
mapView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
} else {
|
||||
mapView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
mapView.initialiseDrawingSurface(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class FocalPointInvalidator implements FocalPointChangeListener {
|
||||
|
||||
private final List<FocalPointChangeListener> focalPointChangeListeners = new ArrayList<>();
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.graphics.SurfaceTexture;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.view.TextureView;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.renderer.egl.EGLConfigChooser;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -219,13 +218,6 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if the size has changed
|
||||
if (sizeChanged) {
|
||||
recreateSurface = true;
|
||||
sizeChanged = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Reset the request render flag now, so we can catch new requests
|
||||
// while rendering
|
||||
requestRender = false;
|
||||
@@ -273,6 +265,12 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sizeChanged) {
|
||||
mapRenderer.onSurfaceChanged(gl, w, h);
|
||||
sizeChanged = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't continue without a surface
|
||||
if (eglHolder.eglSurface == EGL10.EGL_NO_SURFACE) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user