summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorTobrun Van Nuland <tobrun.van.nuland@gmail.com>2017-10-06 16:29:49 +0200
committerTobrun <tobrun@mapbox.com>2017-10-10 15:28:33 +0200
commitff03a75da41be5fd7063e2dc7ef8c281656a8c4c (patch)
tree46f5b717dc5af8326ebae3deb0edcf1c02b4a348 /platform/android
parent24bd336b88b4f2dae25277efeeb36a96061139a3 (diff)
downloadqtlocation-mapboxgl-ff03a75da41be5fd7063e2dc7ef8c281656a8c4c.tar.gz
[android] - hold off handling hover events untill map has been created
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java20
1 files changed, 15 insertions, 5 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 a93d05eaed..260933ffa1 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
@@ -2,8 +2,8 @@ package com.mapbox.mapboxsdk.maps;
import android.content.Context;
import android.graphics.PointF;
-import android.os.Build;
import android.opengl.GLSurfaceView;
+import android.os.Build;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.IntDef;
@@ -47,9 +47,9 @@ import javax.microedition.khronos.opengles.GL10;
import timber.log.Timber;
+import static android.opengl.GLSurfaceView.RENDERMODE_WHEN_DIRTY;
import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION;
import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_WAIT_IDLE;
-import static android.opengl.GLSurfaceView.RENDERMODE_WHEN_DIRTY;
/**
* <p>
@@ -382,7 +382,7 @@ public class MapView extends FrameLayout {
@Override
public boolean onTouchEvent(MotionEvent event) {
- if (!isMapInitialized()) {
+ if (!isMapInitialized() || !isZoomButtonControllerInitialized()) {
return super.onTouchEvent(event);
}
@@ -419,6 +419,10 @@ public class MapView extends FrameLayout {
@Override
public boolean onHoverEvent(MotionEvent event) {
+ if (!isZoomButtonControllerInitialized()) {
+ return super.onHoverEvent(event);
+ }
+
switch (event.getActionMasked()) {
case MotionEvent.ACTION_HOVER_ENTER:
case MotionEvent.ACTION_HOVER_MOVE:
@@ -506,7 +510,9 @@ public class MapView extends FrameLayout {
@CallSuper
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- mapZoomButtonController.setVisible(false);
+ if (isZoomButtonControllerInitialized()) {
+ mapZoomButtonController.setVisible(false);
+ }
}
// Called when view is hidden and shown
@@ -516,7 +522,7 @@ public class MapView extends FrameLayout {
return;
}
- if (mapZoomButtonController != null) {
+ if (isZoomButtonControllerInitialized()) {
mapZoomButtonController.setVisible(visibility == View.VISIBLE);
}
}
@@ -582,6 +588,10 @@ public class MapView extends FrameLayout {
return nativeMapView != null;
}
+ private boolean isZoomButtonControllerInitialized() {
+ return mapZoomButtonController != null;
+ }
+
MapboxMap getMapboxMap() {
return mapboxMap;
}