Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Allowing multiple InfoWindows to be visible at a time #3115

Closed
zugaldia opened this issue Nov 24, 2015 · 13 comments
Closed

Allowing multiple InfoWindows to be visible at a time #3115

zugaldia opened this issue Nov 24, 2015 · 13 comments
Assignees
Labels
Android Mapbox Maps SDK for Android feature

Comments

@zugaldia
Copy link
Member

At the moment, only one InfoWindow can be visible at a time. We want to be able to show multiple at once.

@incanus
Copy link
Contributor

incanus commented 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 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.

@zugaldia
Copy link
Member Author

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().

I'll try that approach in https://github.com/mapbox/mapbox-gl-native/tree/3115-multiple-infowindows

@zugaldia
Copy link
Member Author

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.

@bleege
Copy link
Contributor

bleege commented Nov 29, 2015

@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?

@tobrun
Copy link
Member

tobrun commented 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
Copy link
Member Author

@bleege @tobrun I like it and it changes the API in a consistent way. I'll give it a pass today.

@zugaldia
Copy link
Member Author

Flag implemented in e9d749b.

You can test it on TestApp's InfoWindowActivity and InfoWindowAdapterActivity commenting out the following line in onCreate:

mMapView.setAllowConcurrentMultipleOpenInfoWindows(true);

@tobrun
Copy link
Member

tobrun commented Nov 30, 2015

@zugaldia 🚀

@incanus
Copy link
Contributor

incanus commented 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
Copy link
Member Author

@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.

@zugaldia
Copy link
Member Author

zugaldia commented 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:

@zugaldia zugaldia reopened this Dec 1, 2015
@Piusin
Copy link

Piusin commented Jun 20, 2018

This didn't help me

@zugaldia
Copy link
Member Author

@Piusin thanks for the feedback. Could you open a new ticket explaining the issue that you're encountering? Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android feature
Projects
None yet
Development

No branches or pull requests

6 participants