Repository navigation
Add toggles in NavigationMapboxMap for traffic and incident data - #1226
Conversation
| private void updateLayerVisibility(String layerIdentifier, List<String> sourceIdentifiers, | ||
| List<Layer> layers, boolean isVisible) { | ||
| for (Layer layer : layers) { | ||
| if (!(layer instanceof LineLayer)) { |
There was a problem hiding this comment.
Some of the relevant layers may be SymbolLayers rather than LineLayers.
| Timber.d("sourceIdentifier %s", sourceIdentifier); | ||
| String layerId = layer.getId(); | ||
| Timber.d("layerId %s", layerId); | ||
| if (sourceIdentifiers.contains(sourceIdentifier) && layerId.contains(layerIdentifier)) { |
There was a problem hiding this comment.
The source layer ID needs to match exactly; it isn’t enough for it to contain the source layer ID we’re looking for.
| Timber.d("***** ***** ***** *****"); | ||
| String sourceIdentifier = ((LineLayer) layer).getSourceLayer(); | ||
| Timber.d("sourceIdentifier %s", sourceIdentifier); | ||
| String layerId = layer.getId(); |
There was a problem hiding this comment.
We’re interested in the layer’s source layer’s ID, not the ID of the layer in the style.
e363852 to
0e2d5f9
Compare
|
@1ec5 I added some updates, but the data in the if check still seems to be incorrect. I'm looking for Thanks for the review, appreciate your 👀 on this. |
0e2d5f9 to
e92b8e9
Compare
|
e92b8e9 to
8d60c67
Compare
|
This is working now without the |
dc0d599 to
0bb4c87
Compare
|
@Guardiola31337 @devotaaabel tests and javadoc added - this is ready for 👀 |
devotaaabel
left a comment
There was a problem hiding this comment.
Looks good to me, but I don't have much context on this stuff so I'd say @Guardiola31337 should still review
|
|
||
| class MapIncidents { | ||
|
|
||
| private static final String INCIDENTS_LAYER_ID = "incidents"; |
0bb4c87 to
462bb0a
Compare
1ec5
left a comment
There was a problem hiding this comment.
Looks good to me. A couple non-critical comments follow.
| } | ||
|
|
||
| private boolean isInvalid(Layer layer) { | ||
| return !(layer instanceof LineLayer || layer instanceof SymbolLayer); |
There was a problem hiding this comment.
The double negative is a little confusing. Consider calling the method isValid() and removing the !.
| } | ||
|
|
||
| // TODO find sourceIdentifier for Layer https://github.com/mapbox/mapbox-gl-native/issues/12691 | ||
| private List<String> findSourceIdentifiersFor(String tileSetIdentifier) { |
There was a problem hiding this comment.
This method is unused due to mapbox/mapbox-gl-native#12691. Should it be deleted or commented out until a getSource() or getSourceId() is available?
There was a problem hiding this comment.
I went ahead and deleted the unused code but added the changes as a new commit so we'll be able to recover the code from 462bb0a when mapbox/mapbox-gl-native#12691 lands.
…incidents and traffic apis in navigation mapbox map
|
@1ec5 addressed your comments. Feel free to give it a final round of 👀 |

Searches the given map style for traffic / incident data and, if found, will hide or show the layers.
TODO:
preview-day-v3NavigationMapboxMapjavadoccc @1ec5