From 537fb3df0b7dae5a491285c3b287051c64744ccb Mon Sep 17 00:00:00 2001 From: Tien TRAN-THUONG Date: Tue, 12 Dec 2017 16:38:13 +0100 Subject: [PATCH] Merge branch 'mapbox_release_5.2' into mappy_merge_5.2 * mapbox_release_5.2: (788 commits) release android v5.2.0 release v5.2.0-beta.5 (#10464) [ios] Update puck arrow stroke color when tint changes Monkey crashes (#10440) (#10472) Deploy macosapp as part of releases (#10191) [ios] Update podspecs to v3.7.0-rc.1 [ios] Updated Spanish, Vietnamese translations [ios] Fix toCamera.centerCoordinate in shouldChangeFromCamera (#10433) MapSnapshot attribution (#10362) Downgrade min sdk to 14 (#10355) Update MGLMapSnapshotter docs (#10438) [android] - harden deselection mechanism for markers (#10403) [android] Cherry picks to agua (#10442) [ios] Silence smart invert warnings (#10425) [ios] Doc fixes for "Adding Points to a Map" guide [ios, macos] Cleanup duplicated snapshotter frame code. [android] release 5.2.0-beta.4 (#10384) [android] - add config file for excluding generated tests, refactor generation script output [ios] Bump podspec to beta.4 [ios, macos] Add attribution to snapshots. ... # Conflicts: # .gitignore # .gitmodules # cmake/core-files.cmake # include/mbgl/annotation/annotation.hpp # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/build.gradle # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/MapboxGLAndroidSDK/src/main/AndroidManifest.xml # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java # platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/LatLngBoundsActivity.java # platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java # platform/android/build.gradle # platform/android/config.cmake # platform/android/dependencies.gradle # platform/android/settings.gradle # platform/android/src/map/camera_position.cpp # platform/android/src/native_map_view.cpp # platform/android/src/native_map_view.hpp # src/mbgl/algorithm/generate_clip_ids_impl.hpp # src/mbgl/annotation/line_annotation_impl.cpp # src/mbgl/renderer/layers/render_line_layer.hpp # src/mbgl/renderer/painter.cpp # src/mbgl/renderer/painter_line.cpp # src/mbgl/renderer/render_item.hpp # src/mbgl/renderer/render_line_layer.cpp # src/mbgl/sprite/sprite_atlas.cpp # src/mbgl/sprite/sprite_atlas.hpp # src/mbgl/sprite/sprite_parser.cpp # src/mbgl/sprite/sprite_parser.hpp # src/mbgl/storage/resource.cpp # src/mbgl/style/layers/line_layer.cpp # src/mbgl/style/layers/line_layer_impl.hpp # src/mbgl/style/style.cpp # src/mbgl/style/style.hpp # src/mbgl/tile/tile_loader_impl.hpp # test/algorithm/generate_clip_ids.test.cpp # test/sprite/sprite_atlas.test.cpp # test/storage/resource.test.cpp --- .../java/com/mapbox/mapboxsdk/Mapbox.java | 22 ++++++++++++++----- .../maps/widgets/MarkerViewLayout.java | 6 +++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index 204d6bf20ed..c4649d9747e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -50,12 +50,22 @@ public final class Mapbox { */ @UiThread public static synchronized Mapbox getInstance(@NonNull Context context, @NonNull String accessToken) { + return getInstance(context, accessToken, true); + } + /* + Mappy modif + */ + @UiThread + public static synchronized Mapbox getInstance(@NonNull Context context, @NonNull String accessToken, boolean initWithLocalLocation) { if (INSTANCE == null) { Context appContext = context.getApplicationContext(); - LocationEngineProvider locationEngineProvider = new LocationEngineProvider(context); - LocationEngine locationEngine = locationEngineProvider.obtainBestLocationEngineAvailable(); + LocationEngine locationEngine = null; + if(initWithLocalLocation) { + LocationEngineProvider locationEngineProvider = new LocationEngineProvider(context); + locationEngine = locationEngineProvider.obtainBestLocationEngineAvailable(); + locationEngine.setPriority(LocationEnginePriority.NO_POWER); + } INSTANCE = new Mapbox(appContext, accessToken, locationEngine); - locationEngine.setPriority(LocationEnginePriority.NO_POWER); if(ENABLE_METRICS_ON_MAPPY) { try { @@ -168,8 +178,10 @@ public static LocationEngine getLocationEngine() { return INSTANCE.locationEngine; } - public static void setLocationSource(LocationSource locSource) { - INSTANCE.locationEngine = locSource; + public static void setLocationSource(LocationEngine locSource) { + if(INSTANCE!=null){ + INSTANCE.locationEngine = locSource; + } } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MarkerViewLayout.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MarkerViewLayout.java index 8afebc892f8..fd6f69abc82 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MarkerViewLayout.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MarkerViewLayout.java @@ -4,6 +4,7 @@ import android.content.Context; import android.os.Build; import android.util.AttributeSet; +import android.util.Log; import android.view.View; import android.widget.FrameLayout; @@ -11,6 +12,7 @@ import java.util.Collection; import java.util.Iterator; +import java.util.logging.Logger; public class MarkerViewLayout extends FrameLayout { @@ -50,6 +52,10 @@ public void setMarkerViewManager(MarkerViewManager markerViewManager) { @Override protected int getChildDrawingOrder(int childCount, int drawOrder) { + Log.d("MarkerViewLayout","TTT markerViewManager==null? "+(markerViewManager==null)+" childCount="+childCount+" drawOrder="+drawOrder); + if(markerViewManager==null){ + return 0; + } Collection collectionSorted = markerViewManager.getSortedViews(); if (collectionSorted == null || drawOrder > collectionSorted.size()) { return 0;