diff options
author | Tim Watson <tewatson89@gmail.com> | 2019-04-03 14:51:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-03 14:51:13 -0700 |
commit | 0ff25060dae4858a1b60e2277dbd8921de7a6785 (patch) | |
tree | d29d578b9b9d6cfb0999b7a30819d379b85172b7 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps | |
parent | ba2b7a74c420856401d344ff15b27771175c9819 (diff) | |
parent | 0f416fbbde9b146eb28a4bf88586738d12505007 (diff) | |
download | qtlocation-mapboxgl-0ff25060dae4858a1b60e2277dbd8921de7a6785.tar.gz |
Merge pull request #1 from mapbox/masterupstream/friedbunny-external-pr-14135
Merge Master
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps')
11 files changed, 98 insertions, 116 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/CameraChangeDispatcher.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/CameraChangeDispatcher.java index b3472ac81e..a1fd4e7e3e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/CameraChangeDispatcher.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/CameraChangeDispatcher.java @@ -142,6 +142,14 @@ class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, M } } + void onDestroy() { + handler.removeCallbacksAndMessages(null); + onCameraMoveStarted.clear(); + onCameraMoveCanceled.clear(); + onCameraMove.clear(); + onCameraIdle.clear(); + } + private static class CameraChangeHandler extends Handler { private WeakReference<CameraChangeDispatcher> dispatcherWeakReference; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index c9e6e633aa..9473ea7091 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -74,7 +74,7 @@ final class MapGestureDetector { * User-set focal point. */ @Nullable - private PointF focalPoint; + private PointF constantFocalPoint; private AndroidGesturesManager gesturesManager; @@ -158,7 +158,7 @@ final class MapGestureDetector { /** * Set the gesture focal point. * <p> - * this is the center point used for calculate transformations from gestures, value is + * This is the center point used for calculate transformations from gestures, value is * overridden if end user provides his own through {@link UiSettings#setFocalPoint(PointF)}. * </p> * @@ -172,22 +172,7 @@ final class MapGestureDetector { focalPoint = uiSettings.getFocalPoint(); } } - this.focalPoint = focalPoint; - } - - /** - * Get the current active gesture focal point. - * <p> - * This could be either the user provided focal point in - * {@link UiSettings#setFocalPoint(PointF)}or <code>null</code>. - * If it's <code>null</code>, gestures will use focal pointed returned by the detector. - * </p> - * - * @return the current active gesture focal point. - */ - @Nullable - PointF getFocalPoint() { - return focalPoint; + this.constantFocalPoint = focalPoint; } /** @@ -357,18 +342,25 @@ final class MapGestureDetector { int action = motionEvent.getActionMasked(); if (action == MotionEvent.ACTION_DOWN) { executeDoubleTap = true; + + // disable the move detector in preparation for the quickzoom, + // so that we don't move the map's center slightly before the quickzoom is started (see #14227) + gesturesManager.getMoveGestureDetector().setEnabled(false); } if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { + // re-enabled the move detector + gesturesManager.getMoveGestureDetector().setEnabled(true); + if (!uiSettings.isZoomGesturesEnabled() || !uiSettings.isDoubleTapGesturesEnabled() || !executeDoubleTap) { return false; } PointF zoomFocalPoint; // Single finger double tap - if (focalPoint != null) { + if (constantFocalPoint != null) { // User provided focal point - zoomFocalPoint = focalPoint; + zoomFocalPoint = constantFocalPoint; } else { // Zoom in on gesture zoomFocalPoint = new PointF(motionEvent.getX(), motionEvent.getY()); @@ -468,9 +460,6 @@ final class MapGestureDetector { private final class ScaleGestureListener extends StandardScaleGestureDetector.SimpleStandardOnScaleGestureListener { private final float minimumVelocity; - - @Nullable - private PointF scaleFocalPoint; private boolean quickZoom; ScaleGestureListener(float minimumVelocity) { @@ -496,8 +485,6 @@ final class MapGestureDetector { if (!uiSettings.isQuickZoomGesturesEnabled()) { return false; } - // when quickzoom, disable move gesture - gesturesManager.getMoveGestureDetector().setEnabled(false); } cancelTransitionsIfRequired(); @@ -510,10 +497,7 @@ final class MapGestureDetector { ); } - // setting focalPoint in #onScaleBegin() as well, because #onScale() might not get called before #onScaleEnd() - setScaleFocalPoint(detector); - - sendTelemetryEvent(TelemetryConstants.PINCH, scaleFocalPoint); + sendTelemetryEvent(TelemetryConstants.PINCH, getScaleFocalPoint(detector)); notifyOnScaleBeginListeners(detector); @@ -525,11 +509,10 @@ final class MapGestureDetector { // dispatching camera start event only when the movement actually occurred cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE); - setScaleFocalPoint(detector); - float scaleFactor = detector.getScaleFactor(); double zoomBy = getNewZoom(scaleFactor, quickZoom); - transform.zoomBy(zoomBy, scaleFocalPoint); + PointF focalPoint = getScaleFocalPoint(detector); + transform.zoomBy(zoomBy, focalPoint); notifyOnScaleListeners(detector); @@ -538,11 +521,6 @@ final class MapGestureDetector { @Override public void onScaleEnd(@NonNull StandardScaleGestureDetector detector, float velocityX, float velocityY) { - if (quickZoom) { - //if quickzoom, re-enabling move gesture detector - gesturesManager.getMoveGestureDetector().setEnabled(true); - } - if (uiSettings.isIncreaseRotateThresholdWhenScaling()) { // resetting default angle threshold gesturesManager.getRotateGestureDetector().setAngleThreshold( @@ -562,21 +540,23 @@ final class MapGestureDetector { double zoomAddition = calculateScale(velocityXY, detector.isScalingOut()); double currentZoom = transform.getRawZoom(); + PointF focalPoint = getScaleFocalPoint(detector); long animationTime = (long) (Math.abs(zoomAddition) * 1000 / 4); - scaleAnimator = createScaleAnimator(currentZoom, zoomAddition, scaleFocalPoint, animationTime); + scaleAnimator = createScaleAnimator(currentZoom, zoomAddition, focalPoint, animationTime); scheduleAnimator(scaleAnimator); } - private void setScaleFocalPoint(@NonNull StandardScaleGestureDetector detector) { - if (focalPoint != null) { + @NonNull + private PointF getScaleFocalPoint(@NonNull StandardScaleGestureDetector detector) { + if (constantFocalPoint != null) { // around user provided focal point - scaleFocalPoint = focalPoint; + return constantFocalPoint; } else if (quickZoom) { // around center - scaleFocalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); + return new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); } else { // around gesture - scaleFocalPoint = detector.getFocalPoint(); + return detector.getFocalPoint(); } } @@ -603,14 +583,12 @@ final class MapGestureDetector { } private final class RotateGestureListener extends RotateGestureDetector.SimpleOnRotateGestureListener { - @Nullable - private PointF rotateFocalPoint; private final float minimumScaleSpanWhenRotating; private final float minimumAngularVelocity; private final float defaultSpanSinceStartThreshold; - public RotateGestureListener(float minimumScaleSpanWhenRotating, float minimumAngularVelocity, - float defaultSpanSinceStartThreshold) { + RotateGestureListener(float minimumScaleSpanWhenRotating, float minimumAngularVelocity, + float defaultSpanSinceStartThreshold) { this.minimumScaleSpanWhenRotating = minimumScaleSpanWhenRotating; this.minimumAngularVelocity = minimumAngularVelocity; this.defaultSpanSinceStartThreshold = defaultSpanSinceStartThreshold; @@ -631,10 +609,7 @@ final class MapGestureDetector { gesturesManager.getStandardScaleGestureDetector().interrupt(); } - // setting in #onRotateBegin() as well, because #onRotate() might not get called before #onRotateEnd() - setRotateFocalPoint(detector); - - sendTelemetryEvent(TelemetryConstants.ROTATION, rotateFocalPoint); + sendTelemetryEvent(TelemetryConstants.ROTATION, getRotateFocalPoint(detector)); notifyOnRotateBeginListeners(detector); @@ -647,13 +622,12 @@ final class MapGestureDetector { // dispatching camera start event only when the movement actually occurred cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE); - setRotateFocalPoint(detector); - // Calculate map bearing value double bearing = transform.getRawBearing() + rotationDegreesSinceLast; // Rotate the map - transform.setBearing(bearing, rotateFocalPoint.x, rotateFocalPoint.y); + PointF focalPoint = getRotateFocalPoint(detector); + transform.setBearing(bearing, focalPoint.x, focalPoint.y); notifyOnRotateListeners(detector); @@ -687,21 +661,24 @@ final class MapGestureDetector { angularVelocity = -angularVelocity; } - rotateAnimator = createRotateAnimator(angularVelocity, animationTime); + PointF focalPoint = getRotateFocalPoint(detector); + rotateAnimator = createRotateAnimator(angularVelocity, animationTime, focalPoint); scheduleAnimator(rotateAnimator); } - private void setRotateFocalPoint(@NonNull RotateGestureDetector detector) { - if (focalPoint != null) { + @NonNull + private PointF getRotateFocalPoint(@NonNull RotateGestureDetector detector) { + if (constantFocalPoint != null) { // User provided focal point - rotateFocalPoint = focalPoint; + return constantFocalPoint; } else { // around gesture - rotateFocalPoint = detector.getFocalPoint(); + return detector.getFocalPoint(); } } - private Animator createRotateAnimator(float angularVelocity, long animationTime) { + private Animator createRotateAnimator(float angularVelocity, long animationTime, + @NonNull final PointF animationFocalPoint) { ValueAnimator animator = ValueAnimator.ofFloat(angularVelocity, 0f); animator.setDuration(animationTime); animator.setInterpolator(new DecelerateInterpolator()); @@ -710,7 +687,7 @@ final class MapGestureDetector { public void onAnimationUpdate(@NonNull ValueAnimator animation) { transform.setBearing( transform.getRawBearing() + (float) animation.getAnimatedValue(), - rotateFocalPoint.x, rotateFocalPoint.y, + animationFocalPoint.x, animationFocalPoint.y, 0L ); } @@ -802,9 +779,9 @@ final class MapGestureDetector { PointF zoomFocalPoint; // Single finger double tap - if (focalPoint != null) { + if (constantFocalPoint != null) { // User provided focal point - zoomFocalPoint = focalPoint; + zoomFocalPoint = constantFocalPoint; } else { // Zoom in on gesture zoomFocalPoint = detector.getFocalPoint(); 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 f87c6a854a..23ce2bdef0 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 @@ -911,7 +911,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { /** * Called when the map has finished rendering. * - * @param fully true if map is fully rendered, false if fully rendered + * @param fully true if map is fully rendered, false if not fully rendered */ void onDidFinishRenderingMap(boolean fully); } @@ -1257,4 +1257,4 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { public static void setMapStrictModeEnabled(boolean strictModeEnabled) { MapStrictMode.setStrictModeEnabled(strictModeEnabled); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index f0155bda58..95d5c29b61 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -128,7 +128,6 @@ public final class MapboxMap { * Called when the hosting Activity/Fragment onStart() method is called. */ void onStart() { - nativeMapView.update(); locationComponent.onStart(); } @@ -174,6 +173,10 @@ public final class MapboxMap { */ void onDestroy() { locationComponent.onDestroy(); + if (style != null) { + style.clear(); + } + cameraChangeDispatcher.onDestroy(); } /** @@ -813,7 +816,7 @@ public final class MapboxMap { public void setStyle(Style.Builder builder, final Style.OnStyleLoaded callback) { locationComponent.onStartLoadingMap(); if (style != null) { - style.onWillStartLoadingMap(); + style.clear(); } if (callback != null) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java index cf5961a313..e49126531a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java @@ -29,8 +29,6 @@ interface NativeMap { // Lifecycle API // - void update(); - void resizeView(int width, int height); void onLowMemory(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 10942d521c..a5f8be788c 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -136,15 +136,6 @@ final class NativeMapView implements NativeMap { } @Override - public void update() { - if (checkState("update")) { - return; - } - - mapRenderer.requestRender(); - } - - @Override public void resizeView(int width, int height) { if (checkState("resizeView")) { return; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java index f14e034816..5c28b55de8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java @@ -100,8 +100,8 @@ public class Style { */ public void addSource(@NonNull Source source) { validateState("addSource"); - sources.put(source.getId(), source); nativeMap.addSource(source); + sources.put(source.getId(), source); } /** @@ -172,8 +172,8 @@ public class Style { */ public void addLayer(@NonNull Layer layer) { validateState("addLayer"); - layers.put(layer.getId(), layer); nativeMap.addLayer(layer); + layers.put(layer.getId(), layer); } /** @@ -184,8 +184,8 @@ public class Style { */ public void addLayerBelow(@NonNull Layer layer, @NonNull String below) { validateState("addLayerBelow"); - layers.put(layer.getId(), layer); nativeMap.addLayerBelow(layer, below); + layers.put(layer.getId(), layer); } /** @@ -196,8 +196,8 @@ public class Style { */ public void addLayerAbove(@NonNull Layer layer, @NonNull String above) { validateState("addLayerAbove"); - layers.put(layer.getId(), layer); nativeMap.addLayerAbove(layer, above); + layers.put(layer.getId(), layer); } /** @@ -209,8 +209,8 @@ public class Style { */ public void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index) { validateState("addLayerAbove"); - layers.put(layer.getId(), layer); nativeMap.addLayerAt(layer, index); + layers.put(layer.getId(), layer); } /** @@ -437,10 +437,11 @@ public class Style { // /** - * Called when the underlying map will start loading a new style. This method will clean up this style - * by setting the java sources and layers in a detached state and removing them from core. + * Called when the underlying map will start loading a new style or the map is destroyed. + * This method will clean up this style by setting the java sources and layers + * in a detached state and removing them from core. */ - void onWillStartLoadingMap() { + void clear() { fullyLoaded = false; for (Source source : sources.values()) { if (source != null) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java index 034dc63c35..c671146876 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java @@ -10,6 +10,7 @@ import android.os.Bundle; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.Px; import android.support.annotation.UiThread; import android.support.v4.content.ContextCompat; import android.support.v4.content.res.ResourcesCompat; @@ -344,7 +345,7 @@ public final class UiSettings { } /** - * Sets the margins of the compass view. Use this to change the distance of the compass from the + * Sets the margins of the compass view in pixels. Use this to change the distance of the compass from the * map view edge. * * @param left The left margin in pixels. @@ -353,42 +354,46 @@ public final class UiSettings { * @param bottom The bottom margin in pixels. */ @UiThread - public void setCompassMargins(int left, int top, int right, int bottom) { + public void setCompassMargins(@Px int left, @Px int top, @Px int right, @Px int bottom) { setWidgetMargins(compassView, compassMargins, left, top, right, bottom); } /** - * Returns the left side margin of CompassView + * Returns the left side margin of CompassView in pixels. * * @return The left margin in pixels */ + @Px public int getCompassMarginLeft() { return compassMargins[0]; } /** - * Returns the top side margin of CompassView + * Returns the top side margin of CompassView in pixels. * * @return The top margin in pixels */ + @Px public int getCompassMarginTop() { return compassMargins[1]; } /** - * Returns the right side margin of CompassView + * Returns the right side margin of CompassView in pixels. * * @return The right margin in pixels */ + @Px public int getCompassMarginRight() { return compassMargins[2]; } /** - * Returns the bottom side margin of CompassView + * Returns the bottom side margin of CompassView in pixels. * * @return The bottom margin in pixels */ + @Px public int getCompassMarginBottom() { return compassMargins[3]; } @@ -456,7 +461,7 @@ public final class UiSettings { } /** - * Sets the margins of the logo view. Use this to change the distance of the Mapbox logo from the + * Sets the margins of the logo view in pixels. Use this to change the distance of the Mapbox logo from the * map view edge. * * @param left The left margin in pixels. @@ -464,42 +469,46 @@ public final class UiSettings { * @param right The right margin in pixels. * @param bottom The bottom margin in pixels. */ - public void setLogoMargins(int left, int top, int right, int bottom) { + public void setLogoMargins(@Px int left, @Px int top, @Px int right, @Px int bottom) { setWidgetMargins(logoView, logoMargins, left, top, right, bottom); } /** - * Returns the left side margin of the logo + * Returns the left side margin of the logo in pixels. * * @return The left margin in pixels */ + @Px public int getLogoMarginLeft() { return logoMargins[0]; } /** - * Returns the top side margin of the logo + * Returns the top side margin of the logo in pixels. * * @return The top margin in pixels */ + @Px public int getLogoMarginTop() { return logoMargins[1]; } /** - * Returns the right side margin of the logo + * Returns the right side margin of the logo in pixels. * * @return The right margin in pixels */ + @Px public int getLogoMarginRight() { return logoMargins[2]; } /** - * Returns the bottom side margin of the logo + * Returns the bottom side margin of the logo in pixels. * * @return The bottom margin in pixels */ + @Px public int getLogoMarginBottom() { return logoMargins[3]; } @@ -570,14 +579,14 @@ public final class UiSettings { } /** - * Sets the margins of the attribution view. + * Sets the margins of the attribution view in pixels. * * @param left The left margin in pixels. * @param top The top margin in pixels. * @param right The right margin in pixels. * @param bottom The bottom margin in pixels. */ - public void setAttributionMargins(int left, int top, int right, int bottom) { + public void setAttributionMargins(@Px int left, @Px int top, @Px int right, @Px int bottom) { setWidgetMargins(attributionsView, attributionsMargins, left, top, right, bottom); } @@ -599,37 +608,41 @@ public final class UiSettings { } /** - * Returns the left side margin of the attribution view. + * Returns the left side margin of the attribution view in pixels. * * @return The left margin in pixels */ + @Px public int getAttributionMarginLeft() { return attributionsMargins[0]; } /** - * Returns the top side margin of the attribution view. + * Returns the top side margin of the attribution view in pixels. * * @return The top margin in pixels */ + @Px public int getAttributionMarginTop() { return attributionsMargins[1]; } /** - * Returns the right side margin of the attribution view. + * Returns the right side margin of the attribution view in pixels. * * @return The right margin in pixels */ + @Px public int getAttributionMarginRight() { return attributionsMargins[2]; } /** - * Returns the bottom side margin of the logo + * Returns the bottom side margin of the logo in pixels. * * @return The bottom margin in pixels */ + @Px public int getAttributionMarginBottom() { return attributionsMargins[3]; } 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..524c1a62ee 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,8 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi @Override public void surfaceDestroyed(SurfaceHolder holder) { - requestDestroy = true; + onSurfaceDestroyed(); } - }); } @@ -60,9 +55,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; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java index 6262418a29..53c0c1c60f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java @@ -7,10 +7,10 @@ import android.support.annotation.Nullable; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPropertyAnimatorCompat; import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; -import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -23,7 +23,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; * use {@link com.mapbox.mapboxsdk.maps.UiSettings}. * </p> */ -public final class CompassView extends AppCompatImageView implements Runnable { +public final class CompassView extends ImageView implements Runnable { public static final long TIME_WAIT_IDLE = 500; public static final long TIME_MAP_NORTH_ANIMATION = 150; |