From 3672b5dba44b6d8589dc35faf228071833ba92af Mon Sep 17 00:00:00 2001 From: tobrun Date: Tue, 26 Mar 2019 13:47:58 +0100 Subject: [android] - remove assertion, replace with log invocation --- .../java/com/mapbox/mapboxsdk/maps/MapView.java | 2 +- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 85 ++++++++++++---------- platform/android/src/map_renderer.cpp | 6 +- 3 files changed, 51 insertions(+), 42 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 23ce2bdef0..d1ba44418b 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 @@ -349,7 +349,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { isStarted = true; } if (mapboxMap != null) { - mapboxMap.onStart(); + mapboxMap.onStart(hasSurface); } if (mapRenderer != null) { 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 ebfac5a021..2874b43cb8 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 @@ -127,8 +127,10 @@ public final class MapboxMap { /** * Called when the hosting Activity/Fragment onStart() method is called. */ - void onStart() { - nativeMapView.update(); + void onStart(boolean hasSurface) { + if (hasSurface) { + nativeMapView.update(); + } locationComponent.onStart(); } @@ -866,7 +868,7 @@ public final class MapboxMap { * @return The {@code Marker} that was added to the map * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -885,7 +887,7 @@ public final class MapboxMap { * @return The {@code Marker} that was added to the map * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -904,7 +906,7 @@ public final class MapboxMap { * @return A list of the {@code Marker}s that were added to the map * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -921,7 +923,7 @@ public final class MapboxMap { * @param updatedMarker An updated marker object * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void updateMarker(@NonNull Marker updatedMarker) { @@ -935,7 +937,7 @@ public final class MapboxMap { * @return The {@code Polyine} that was added to the map * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -950,7 +952,7 @@ public final class MapboxMap { * @return A list of the {@code Polyline}s that were added to the map. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -964,7 +966,7 @@ public final class MapboxMap { * @param polyline An updated polyline object. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void updatePolyline(@NonNull Polyline polyline) { @@ -978,7 +980,7 @@ public final class MapboxMap { * @return The {@code Polygon} that was added to the map. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -993,7 +995,7 @@ public final class MapboxMap { * @return A list of the {@code Polygon}s that were added to the map * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -1007,7 +1009,7 @@ public final class MapboxMap { * @param polygon An updated polygon object * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void updatePolygon(@NonNull Polygon polygon) { @@ -1023,7 +1025,7 @@ public final class MapboxMap { * @param marker Marker to remove * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void removeMarker(@NonNull Marker marker) { @@ -1039,7 +1041,7 @@ public final class MapboxMap { * @param polyline Polyline to remove * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void removePolyline(@NonNull Polyline polyline) { @@ -1055,7 +1057,7 @@ public final class MapboxMap { * @param polygon Polygon to remove * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void removePolygon(@NonNull Polygon polygon) { @@ -1068,7 +1070,7 @@ public final class MapboxMap { * @param annotation The annotation object to remove. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void removeAnnotation(@NonNull Annotation annotation) { @@ -1081,7 +1083,7 @@ public final class MapboxMap { * @param id The identifier associated to the annotation to be removed * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void removeAnnotation(long id) { @@ -1094,7 +1096,7 @@ public final class MapboxMap { * @param annotationList A list of annotation objects to remove. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void removeAnnotations(@NonNull List annotationList) { @@ -1103,9 +1105,10 @@ public final class MapboxMap { /** * Removes all annotations from the map. + * * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void removeAnnotations() { @@ -1114,9 +1117,10 @@ public final class MapboxMap { /** * Removes all markers, polylines, polygons, overlays, etc from the map. + * * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void clear() { @@ -1130,7 +1134,7 @@ public final class MapboxMap { * @return An annotation with a matched id, null is returned if no match was found * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @Nullable @@ -1145,7 +1149,7 @@ public final class MapboxMap { * list will not update the map * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -1160,7 +1164,7 @@ public final class MapboxMap { * list will not update the map. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -1175,7 +1179,7 @@ public final class MapboxMap { * list will not update the map. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -1190,7 +1194,7 @@ public final class MapboxMap { * list will not update the map. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -1205,7 +1209,7 @@ public final class MapboxMap { * To unset the callback, use null. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void setOnMarkerClickListener(@Nullable OnMarkerClickListener listener) { @@ -1219,7 +1223,7 @@ public final class MapboxMap { * To unset the callback, use null. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void setOnPolygonClickListener(@Nullable OnPolygonClickListener listener) { @@ -1233,7 +1237,7 @@ public final class MapboxMap { * To unset the callback, use null. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void setOnPolylineClickListener(@Nullable OnPolylineClickListener listener) { @@ -1251,7 +1255,7 @@ public final class MapboxMap { * @param marker The marker to select. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void selectMarker(@NonNull Marker marker) { @@ -1264,9 +1268,10 @@ public final class MapboxMap { /** * Deselects any currently selected marker. All markers will have it's info window closed. + * * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void deselectMarkers() { @@ -1279,7 +1284,7 @@ public final class MapboxMap { * @param marker the marker to deselect * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void deselectMarker(@NonNull Marker marker) { @@ -1292,7 +1297,7 @@ public final class MapboxMap { * @return The currently selected marker. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @NonNull @@ -1315,7 +1320,7 @@ public final class MapboxMap { * To unset the callback, use null. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void setInfoWindowAdapter(@Nullable InfoWindowAdapter infoWindowAdapter) { @@ -1328,7 +1333,7 @@ public final class MapboxMap { * @return The callback to be invoked when an info window will be shown. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated @Nullable @@ -1342,7 +1347,7 @@ public final class MapboxMap { * @param allow If true, map allows concurrent multiple infowindows to be shown. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public void setAllowConcurrentMultipleOpenInfoWindows(boolean allow) { @@ -1355,7 +1360,7 @@ public final class MapboxMap { * @return If true, map allows concurrent multiple infowindows to be shown. * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public boolean isAllowConcurrentMultipleOpenInfoWindows() { @@ -2180,7 +2185,7 @@ public final class MapboxMap { * @see MapboxMap#setOnMarkerClickListener(OnMarkerClickListener) * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public interface OnMarkerClickListener { @@ -2199,7 +2204,7 @@ public final class MapboxMap { * @see MapboxMap#setOnPolygonClickListener(OnPolygonClickListener) * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public interface OnPolygonClickListener { @@ -2217,7 +2222,7 @@ public final class MapboxMap { * @see MapboxMap#setOnPolylineClickListener(OnPolylineClickListener) * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public interface OnPolylineClickListener { @@ -2280,7 +2285,7 @@ public final class MapboxMap { * @see MapboxMap#setInfoWindowAdapter(InfoWindowAdapter) * @deprecated As of 7.0.0, * use - * Mapbox Annotation Plugin instead + * Mapbox Annotation Plugin instead */ @Deprecated public interface InfoWindowAdapter { diff --git a/platform/android/src/map_renderer.cpp b/platform/android/src/map_renderer.cpp index 8d226c0008..a8f8c9a8fe 100644 --- a/platform/android/src/map_renderer.cpp +++ b/platform/android/src/map_renderer.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include @@ -122,7 +123,10 @@ void MapRenderer::scheduleSnapshot(std::unique_ptr callback) { } void MapRenderer::render(JNIEnv&) { - assert (renderer); + if (!renderer) { + Log::Error(Event::Android, "Skipping render, renderer not ready yet"); + return; + } std::shared_ptr params; { -- cgit v1.2.1