summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-10-18 14:49:25 +0200
committerTobrun <tobrun@mapbox.com>2018-10-24 10:52:41 +0200
commitfc2afc1d23e23f2fc27626409e974e6846020ec5 (patch)
treec0d5eab705081f096eb11f3e59857c8e1d1c185b
parentd7d48c3ebcd18eb321acf10efd410eae3b46c5fc (diff)
downloadqtlocation-mapboxgl-fc2afc1d23e23f2fc27626409e974e6846020ec5.tar.gz
[android] - remove view tree observer
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java29
1 files changed, 1 insertions, 28 deletions
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 1c92b3fe0b..829721744b 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
@@ -5,7 +5,6 @@ import android.graphics.Bitmap;
import android.graphics.PointF;
import android.graphics.drawable.ColorDrawable;
import android.opengl.GLSurfaceView;
-import android.os.Build;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.IntDef;
@@ -20,7 +19,6 @@ import android.view.MotionEvent;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ZoomButtonsController;
@@ -144,8 +142,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
// add accessibility support
setContentDescription(context.getString(R.string.mapbox_mapActionDescription));
setWillNotDraw(false);
-
- getViewTreeObserver().addOnGlobalLayoutListener(new MapViewLayoutListener(this, options));
+ initialiseDrawingSurface(options);
}
private void initialiseMap() {
@@ -1366,30 +1363,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
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<>();