Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Fix OnMapReady delivery when a new style is requested before the map is initialized #13203

Merged
merged 2 commits into from
Oct 26, 2018

Conversation

LukasPaczos
Copy link
Member

Fixes a small regression introduced by the #13133 - when requesting a new style before the drawing surface is initialized, before, we were relying on NativeMapView being created after the view hierarchy is established, which means, that calls like mapView#setStyleUrl done in the #onCreate would add the style to the MapboxMapOptions, because NativeMapView was still null. Now, we are initializing the NativeMapView immediately, which means that calling mapView#setStyleUrl would start loading the style instantly introducing a race condition - we would either create the drawing surface before the style is loaded, then the execution continued as expected, or the style would've loaded first, resulting in not delivering OnMapReady at all.

The other part of this PR removes the usage of the deprecated OnMapChange listener across the project.

@LukasPaczos LukasPaczos added the Android Mapbox Maps SDK for Android label Oct 26, 2018
@LukasPaczos LukasPaczos added this to the android-v6.7.0 milestone Oct 26, 2018
@LukasPaczos LukasPaczos force-pushed the lp-fix-style-loading-before-map-initialized branch from c86154d to 13c9956 Compare October 26, 2018 10:20
@LukasPaczos LukasPaczos force-pushed the lp-fix-style-loading-before-map-initialized branch from 13c9956 to 7d41c34 Compare October 26, 2018 10:47
@LukasPaczos LukasPaczos merged commit e2ec125 into master Oct 26, 2018
@LukasPaczos LukasPaczos deleted the lp-fix-style-loading-before-map-initialized branch October 26, 2018 11:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants