Repository navigation
Allow pre-loaded MapboxMap images / maki icons in LocationLayerOptions - #574
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.
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.
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.
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.
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.
@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.
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 |
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.