-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should stick to a single OnMapReadyCallback
to keep it consistent with by-hand initialization?
|
||
private final List<OnMapReadyCallback> mapReadyCallbackList = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't have an API with a list of listeners for OnMapReadyCallback
when instantiating it by hand I don't know why should we include it here. Was that a requested feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Override | ||
public void onMapReady(MapboxMap mapboxMap) { | ||
this.mapboxMap = mapboxMap; | ||
if (!mapReadyCallbackList.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check's redundant. Besides that, the same question as above about the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is not redundant, checking if a list is not empty before looping it will avoid creating an iterator. In code path that are called often this can make a difference. In this case though it doesn't result in any significant memory growth since it's only called once. I will remove it.
…lback for multiple listeners
8b14456
to
a82f959
Compare
* mapbox_release_5.3: (25 commits) [android] - update changelog for 5.3.0 [android] added map touch listeners api based on lists [android] Tweak TinySDF docs to better describe font-family behavior. Saving/restoring MyLocationViewSettings (mapbox#10746) (mapbox#10748) [android] Updated Spanish, Vietnamese translations Android SDK renaming (mapbox#10609) [android] - use default icon when compass icon fails to decode (mapbox#10694) [android] - remove startup flash from fragment, rework OnMapReady callback for multiple listeners (mapbox#10717) [android] Add Configuration hook for local ideograph font family and demo activity [android] Android implementation of local CJK glyph rendering - Draws bold version of glyph if font stack contains string "bold" - Not hooked up to global configuration yet [core] Hook LocalGlyphRasterizer "font family" configuration up to Renderer [core] Enable local glyph generation using TinySDF. - Platform-specific LocalGlyphRasterizer is responsible for deciding which glyphs to rasterize locally and for implementing the rasterization. - Default platform implementation doesn't locally generate any glyphs -> no behavior change - Unit test uses StubLocalGlyphRasterizer, which returns a single fixed bitmap for all CJK glyphs - Rename glyph_loader.test to glyph_manager.test [core] C++ port of TinySDF [ios, macos] Cleaned up base localization files [android] - update instrumented make target, move code style validation before building C++ code, replace code style checks with the wrapper code style check. (mapbox#10724) [android] - activate filesource when creating an offline region (mapbox#10718) [ios] update constraints when updating content inset [ios] Fix an Interface Builder crash for IBInspectable properties. [ios] Fix the content insets for the scale and compass view. Post camera listener invocations (mapbox#10690) ... # Conflicts: # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
This PR optimises showing a Map inside a fragment by hiding the surface on startup and only making it visible when the map is ready. Additionally this PR also allows to use multiple subscribers for OnMapReady events.
before
after