summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2018-10-29 16:00:04 +0100
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2018-10-30 19:32:14 +0100
commit2aef28c0ed0b9e37dff06ba62f1b8ac9cb0b1b18 (patch)
tree7a482d066b9a07c3ae9d480181bc37f9e203038f /platform
parent2ef9580565e2125e07124d23c0bcf400c8736931 (diff)
downloadqtlocation-mapboxgl-2aef28c0ed0b9e37dff06ba62f1b8ac9cb0b1b18.tar.gz
[android] remove isMapInitialized check
Diffstat (limited to 'platform')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java35
1 files changed, 7 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 e373f6c1b1..b8edbc479e 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
@@ -323,8 +323,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
nativeMapView = new NativeMapView(
getContext(), getPixelRatio(), crossSourceCollisions, this, mapChangeReceiver, mapRenderer
);
-
- nativeMapView.resizeView(getMeasuredWidth(), getMeasuredHeight());
}
private void onSurfaceCreated() {
@@ -451,7 +449,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
@Override
public boolean onTouchEvent(MotionEvent event) {
- if (!isMapInitialized() || !isZoomButtonControllerInitialized() || !isGestureDetectorInitialized()) {
+ if (!isZoomButtonControllerInitialized() || !isGestureDetectorInitialized()) {
return super.onTouchEvent(event);
}
@@ -550,13 +548,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
* @see Style
*/
public void setStyleUrl(@NonNull String url) {
- if (destroyed) {
- return;
- }
- if (!isMapInitialized()) {
- mapboxMapOptions.styleUrl(url);
- return;
- }
nativeMapView.setStyleUrl(url);
}
@@ -567,10 +558,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
* @see OfflineRegionDefinition
*/
public void setOfflineRegionDefinition(OfflineRegionDefinition definition) {
- if (destroyed) {
- return;
- }
-
if (definition instanceof OfflineTilePyramidRegionDefinition) {
setOfflineTilePyramidRegionDefinition((OfflineTilePyramidRegionDefinition) definition);
} else if (definition instanceof OfflineGeometryRegionDefinition) {
@@ -586,15 +573,15 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
.zoom(minZoom)
.build();
setStyleUrl(styleUrl);
- if (!isMapInitialized()) {
+ if (mapboxMap != null) {
+ mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
+ mapboxMap.setMinZoomPreference(minZoom);
+ mapboxMap.setMaxZoomPreference(maxZoom);
+ } else {
mapboxMapOptions.camera(cameraPosition);
mapboxMapOptions.minZoomPreference(minZoom);
mapboxMapOptions.maxZoomPreference(maxZoom);
- return;
}
- mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
- mapboxMap.setMinZoomPreference(minZoom);
- mapboxMap.setMaxZoomPreference(maxZoom);
}
private void setOfflineTilePyramidRegionDefinition(OfflineTilePyramidRegionDefinition regionDefinition) {
@@ -619,11 +606,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
@Override
protected void onSizeChanged(int width, int height, int oldw, int oldh) {
- if (destroyed) {
- return;
- }
-
- if (!isInEditMode() && isMapInitialized()) {
+ if (!isInEditMode()) {
nativeMapView.resizeView(width, height);
}
}
@@ -1095,10 +1078,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
}
}
- private boolean isMapInitialized() {
- return nativeMapView != null;
- }
-
private boolean isZoomButtonControllerInitialized() {
return mapZoomButtonController != null;
}