You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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).
I've started work on this functionality by re-enabling access to Marker.setTitle() and Marker.setSnippet() to be the API for updating this content as this is consistent with how the other dynamic marker APIs work (Marker.setPosition() and Marker.setIcon() API ). I've also updated the test case for this in the TestApp's DynamicMarkerChangeActivity so that work on this can commence. So far the InfoWindow moves from location to location just fine, but the content doesn't update. As shown below, when the FAB is originally pressed to do the initial toggle Chelsea's content appears above Arsensal's marker and icon (sorry @jacquestardie ).
I've now added the functionality to update the existing InfoWindow that uses the default InfoWindow for setTitle() and setSnippet(). There's a bit of race condition causing the InfoWindow content to be updated a split second before the InfoWindow is moved to it's new location. I think this has to do with the update process and the (likely unusual) use case as this case is setting all four properties at once and then calling updateMarker() after each property is set.
The next steps are to:
Verify that updated title and snippet works in InfoWindow when the InfoWindow is closed between FAB toggles
Verify that the updated title and snippet works in InfoWindow when the InfoWindow isn't moved
Try to minimize the number of updateMarker() calls
// Use Case Updating all four 4 itemsprivatevoidupdateMarker() {
// update modelbooleanfirst = (boolean) mMapView.getTag();
mMapView.setTag(!first);
// update markermMarker.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 calledMapboxMapmap = getMapboxMap();
if (map != null) {
map.updateMarker(this);
}
Commenting out the updateMarker code from refreshInfoWindowContent() still updates the InfoWindow content (yay!), but I'm also still seeing a bit of lag between the two. I'm going to try removing the updateMarker() calls that are generated by the setPosition() and setIcon() that are part of this test.
MapboxMapmap = 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.
Activity
[android] #5237 - Adding InfoWindow Title and Snippet to DynamicMarke…
bleege commentedon Jun 6, 2016
I've started work on this functionality by re-enabling access to
Marker.setTitle()andMarker.setSnippet()to be the API for updating this content as this is consistent with how the other dynamic marker APIs work (Marker.setPosition()andMarker.setIcon()API ). I've also updated the test case for this in the TestApp'sDynamicMarkerChangeActivityso that work on this can commence. So far the InfoWindow moves from location to location just fine, but the content doesn't update. As shown below, when the FAB is originally pressed to do the initial toggle Chelsea's content appears above Arsensal's marker and icon (sorry @jacquestardie ).Original State
State After First Toggle
[android] #5237 - Update Title and Snippet InfoWindow content when Ma…
[android] #5237 - Adding check to make sure only the default Marker's…
jqtrde commentedon Jun 6, 2016
@bleege I hope this is at the top top top of your list of things to do 😄
bleege commentedon Jun 6, 2016
I've now added the functionality to update the existing InfoWindow that uses the default InfoWindow for
setTitle()andsetSnippet(). There's a bit of race condition causing the InfoWindow content to be updated a split second before the InfoWindow is moved to it's new location. I think this has to do with the update process and the (likely unusual) use case as this case is setting all four properties at once and then callingupdateMarker()after each property is set.The next steps are to:
updateMarker()callsbleege commentedon Jun 6, 2016
☑️
bleege commentedon Jun 7, 2016
☑️
bleege commentedon Jun 7, 2016
Commenting out the updateMarker code from
refreshInfoWindowContent()still updates the InfoWindow content (yay!), but I'm also still seeing a bit of lag between the two. I'm going to try removing the updateMarker() calls that are generated by thesetPosition()andsetIcon()that are part of this test.bleege commentedon Jun 7, 2016
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.
[android] #5237 - Enabled Updates To InfoWindow's Title and Snippet
bleege commentedon Jun 7, 2016
Squashed and Merged into
release-android-v4.1.0.