-
Notifications
You must be signed in to change notification settings - Fork 117
Allow pre-loaded MapboxMap images / maki icons in LocationLayerOptions #574
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
Conversation
| String foregroundStaleIconString = buildIconString(options.foregroundStaleName(), FOREGROUND_STALE_ICON); | ||
| String backgroundIconString = buildIconString(options.backgroundName(), BACKGROUND_ICON); | ||
| String backgroundStaleIconString = buildIconString(options.backgroundStaleName(), BACKGROUND_STALE_ICON); | ||
| String bearingIconString = buildIconString(options.bearingName(), BEARING_ICON); |
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.
I think this values would have to be moved to the location feature, otherwise, you'd not be able to revert this custom image names when resetting the style on an already initialized plugin.
We could also document this behavior and leave as is, thoughts?
LukasPaczos
left a comment
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 looks great! Questions/comments below.
|
|
||
| private void styleForeground(@NonNull LocationLayerOptions options) { | ||
| boolean isGpsRenderMode = renderMode == RenderMode.GPS; | ||
| if (options.foregroundName() == null) { |
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.
Can we have separate cases for foregroundName and foregroundGpsName? This would allow for providing an id for both normal foreground icon, as well as a GPS one.
|
|
||
| private void styleShadow(LocationLayerOptions options) { | ||
| Drawable shadowDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_user_icon_shadow); | ||
| if (shadowDrawable == null) { |
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 drawable is provided by the plugin, can it be null?
|
|
||
| private void addSymbolLayer(String layerId, String beforeLayerId) { | ||
| private void addSymbolLayer(String layerId, String beforeLayerId, LocationLayerOptions options) { | ||
| String foregroundString = options.gpsName() != null ? options.gpsName() : options.foregroundName(); |
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.
@LukasPaczos ran into a possible issue here - the GPS / Foreground drawables both share the foreground icon layer. At the time we add the symbol layer here, we don't know what render mode we are in yet. So a decision needs to be made as far as what String is used. Here I prioritized the GPS name. What do you think?
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.
I think the resolution here would be keeping the string IDs of the used images in the locationFeature, this way we would be able to update them in the runtime, without reloading the map.
|
@LukasPaczos thanks for the feedback! Any ideas on how to alternate between |
|
@LukasPaczos the |
LukasPaczos
left a comment
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.
🚀
Closes #486
This PR introduces options to use
Stringnames for icons that have already been added to theMapboxMapwithMapboxMap#addImage. Developers may also provide names for Maki icons that are already loaded in their given style.