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

Avoid creating InfoWindow iterator if no InfoWindows are shown #9477

Merged
merged 1 commit into from
Jul 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@
*/
class InfoWindowManager {

private List<InfoWindow> infoWindows;
private final List<InfoWindow> infoWindows = new ArrayList<>();

private MapboxMap.InfoWindowAdapter infoWindowAdapter;
private boolean allowConcurrentMultipleInfoWindows;

private MapboxMap.OnInfoWindowClickListener onInfoWindowClickListener;
private MapboxMap.OnInfoWindowLongClickListener onInfoWindowLongClickListener;
private MapboxMap.OnInfoWindowCloseListener onInfoWindowCloseListener;

InfoWindowManager() {
this.infoWindows = new ArrayList<>();
}

void update() {
for (InfoWindow infoWindow : infoWindows) {
infoWindow.update();
if (!infoWindows.isEmpty()) {
for (InfoWindow infoWindow : infoWindows) {
infoWindow.update();
}
}
}

Expand All @@ -56,10 +55,6 @@ boolean isAllowConcurrentMultipleOpenInfoWindows() {
return allowConcurrentMultipleInfoWindows;
}

List<InfoWindow> getInfoWindows() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to remove this getter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was unused & not part of our public api

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobrun 👍

return infoWindows;
}

boolean isInfoWindowValidForMarker(@NonNull Marker marker) {
return !TextUtils.isEmpty(marker.getTitle()) || !TextUtils.isEmpty(marker.getSnippet());
}
Expand Down