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.
Allowing multiple InfoWindows to be visible at a time #3115
To analog (verb?) the iOS side, the selectAnnotations: API there allows for multiple annotations to be passed to selection but, like Apple Maps, to only set selected state on the first one (see here).
I think it's best on iOS to probably stick to that, but since on Android we have some needs for multiple popups, we can maybe use that API as a model, albeit with slightly different behavior.
In that case, and to mimic selectedAnnotations, we could just move from a private Marker mSelectedMarker; to a private List<Marker> mSelectedMarkers = new ArrayList<>(); and change the internal MapView logic accordingly. API-wise, public Marker getSelectedMarker() will become public List<Marker> getSelectedMarkers().
@zugaldia@tobrun FWIW, let's leave the "default" mode to be just 1 InfoWindow open at a time per MapView as this is likely to be the majority of desired use cases for developers. This means that we'll want to have a flag of some sort on the MapView to enable multiple visible InfoWindow support. Something like setAllowConcurrentMultipleOpenInfoWindows(boolean allow). I'm not currently seeing this in #3127. Thoughts?
@bleege seems logical, I consider having multiple open to be a special kind of requirement. @zugaldia can you take this up? currently not on the project.
We'll need some thinking about the UI interactions here. For example, I'm guessing that when one or more info windows are up and you tap on a non-interactive part of the map, all are dismissed? We should probably keep it that way for simplicity.
@incanus that's right, tapping on a non-interactive part of the map dismisses them all. It feels pretty natural right now, but we can definitely learn with usage.
I'm reopening this issue. Although the basic functionality is there and performing well for a low number of InfoWindows, there're still a few related things that need to be addressed:
Activity
incanus commentedon Nov 24, 2015
To analog (verb?) the iOS side, the
selectAnnotations:API there allows for multiple annotations to be passed to selection but, like Apple Maps, to only setselectedstate on the first one (see here).I think it's best on iOS to probably stick to that, but since on Android we have some needs for multiple popups, we can maybe use that API as a model, albeit with slightly different behavior.
zugaldia commentedon Nov 24, 2015
In that case, and to mimic
selectedAnnotations, we could just move from aprivate Marker mSelectedMarker;to aprivate List<Marker> mSelectedMarkers = new ArrayList<>();and change the internalMapViewlogic accordingly. API-wise,public Marker getSelectedMarker()will becomepublic List<Marker> getSelectedMarkers().I'll try that approach in https://github.com/mapbox/mapbox-gl-native/tree/3115-multiple-infowindows
[android] #3115 reposition info windows that have been repositioned w…
zugaldia commentedon Nov 25, 2015
Good progress on both keeping the InfoWindow open and also allowing an InfoWindow to be open while panning.
Before having a PR ready we need to do some small refactoring. As discussed, we don't see a performance hit for such a small number of InfoWindows.
[android] #3115 - optimised + cleanup before PR
bleege commentedon Nov 29, 2015
@zugaldia @tobrun FWIW, let's leave the "default" mode to be just 1
InfoWindowopen at a time per MapView as this is likely to be the majority of desired use cases for developers. This means that we'll want to have a flag of some sort on theMapViewto enable multiple visibleInfoWindowsupport. Something likesetAllowConcurrentMultipleOpenInfoWindows(boolean allow). I'm not currently seeing this in #3127. Thoughts?tobrun commentedon Nov 30, 2015
@bleege seems logical, I consider having multiple open to be a special kind of requirement.
@zugaldia can you take this up? currently not on the project.
zugaldia commentedon Nov 30, 2015
@bleege @tobrun I like it and it changes the API in a consistent way. I'll give it a pass today.
zugaldia commentedon Nov 30, 2015
Flag implemented in e9d749b.
You can test it on TestApp's
InfoWindowActivityandInfoWindowAdapterActivitycommenting out the following line inonCreate:tobrun commentedon Nov 30, 2015
@zugaldia 🚀
incanus commentedon Nov 30, 2015
We'll need some thinking about the UI interactions here. For example, I'm guessing that when one or more info windows are up and you tap on a non-interactive part of the map, all are dismissed? We should probably keep it that way for simplicity.
zugaldia commentedon Nov 30, 2015
@incanus that's right, tapping on a non-interactive part of the map dismisses them all. It feels pretty natural right now, but we can definitely learn with usage.
Added sample `InfoWindowConcurrentActivity` to illustrate the behavio…
zugaldia commentedon Dec 1, 2015
I'm reopening this issue. Although the basic functionality is there and performing well for a low number of InfoWindows, there're still a few related things that need to be addressed:
onSingleTapConfirmed()logic needs to be updated: onSingleTapConfirmed() logic needs to be updated #3156Piusin commentedon Jun 20, 2018
This didn't help me
zugaldia commentedon Jun 20, 2018
@Piusin thanks for the feedback. Could you open a new ticket explaining the issue that you're encountering? Thanks.