Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track SymbolManager image additions? #860

Closed
Guardiola31337 opened this issue Mar 4, 2019 · 3 comments
Closed

Track SymbolManager image additions? #860

Guardiola31337 opened this issue Mar 4, 2019 · 3 comments

Comments

@Guardiola31337
Copy link
Contributor

Follow up from mapbox/mapbox-navigation-android#1779 (comment)

@LukasPaczos:

The SymbolManager has a feature of keeping annotations alive across style changes. The issue here is, that when the style changes, you're not re-adding the icon image of the marker, so the manager doesn't have a resource to reference anymore.

The gist is, that you need to call something like

mapView.addOnDidFinishLoadingStyleListener(new MapView.OnDidFinishLoadingStyleListener() {
 @Override
 public void onDidFinishLoadingStyle() {
   mapboxMap.getStyle(new Style.OnStyleLoaded() {
     @Override
     public void onStyleLoaded(@NonNull Style style) {
       Bitmap markerBitmap = ThemeSwitcher.retrieveThemeMapMarker(mapView.getContext());
       style.addImage(MAPBOX_NAVIGATION_MARKER_NAME, markerBitmap);
     }
   });
 }
});

wherever it's best based on the navigation setup. The plugin will take care of the rest.

@Guardiola31337:

would it make sense for the SymbolManager to keep track of this as well?

Cutting this ticket to discuss if it'd make sense and implementation details.

@LukasPaczos:

adding an image is a separate entry point to the style object and exposing a duplicate method on the manager's side just to track additions would cause confusion imo. But maybe we could rethink that as an options parameter?

cc @LukasPaczos @danesfeder

@LukasPaczos
Copy link
Member

If we'd like to move forward on this, another option would be exposing an interceptor of the Style object that would fire callbacks when an element is added.

@tobrun
Copy link
Member

tobrun commented Mar 4, 2019

Linking #742 as this could be potentially in scope for that feature.

@tobrun
Copy link
Member

tobrun commented Jun 28, 2019

This is moving in #1000, closing this already as it's a dupe of #742

@tobrun tobrun closed this as completed Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants