-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Make InfoWindow dynamically updatable #5237
Comments
I've started work on this functionality by re-enabling access to |
@bleege I hope this is at the top top top of your list of things to do 😄 |
I've now added the functionality to update the existing InfoWindow that uses the default InfoWindow for The next steps are to:
// Use Case Updating all four 4 items
private void updateMarker() {
// update model
boolean first = (boolean) mMapView.getTag();
mMapView.setTag(!first);
// update marker
mMarker.setPosition(first ? LAT_LNG_CHELSEA : LAT_LNG_ARSENAL);
mMarker.setIcon(mIconFactory.fromResource(first ? R.drawable.ic_chelsea : R.drawable.ic_arsenal));
mMarker.setTitle(first ? getString(R.string.dynamic_marker_chelsea_title) : getString(R.string.dynamic_marker_arsenal_title));
mMarker.setSnippet(first ? getString(R.string.dynamic_marker_chelsea_snippet) : getString(R.string.dynamic_marker_arsenal_snippet));
}
// Update being run after each setXXX() method is called
MapboxMap map = getMapboxMap();
if (map != null) {
map.updateMarker(this);
} |
Commenting out the updateMarker code from MapboxMap map = getMapboxMap();
if (map != null) {
map.updateMarker(this);
} |
Discussed the split second offset issue with @zugaldia @cammace @ivovandongen this morning and we decided to ship with this to start with and look to refine over time. The fundamental issue is that the InfoWindow is rendered at the Java View level while the annotation is rendered in Core GL. |
Squashed and Merged into |
We expose setTitle and setSnippet on Marker to set the contents of the default InfoWindow. At this point you can only set them once. Calling these methods consecutively will not always result in changing the contents of the InfoWindow (eg. when it's already open). We have been hearing about the requirement to do this and this follows the line set in
4.1.0
to make other Marker attributes updatable.We should also look into the possibility to expose an InfoWindowAdapter equivalent for this use-case by exposing an invalidate method on InfoWindowAdapter (this will result in recreating the InfoWindow).
The text was updated successfully, but these errors were encountered: