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

Commit

Permalink
[android] - avoid creating InfoWindow iterator if no InfoWindows are …
Browse files Browse the repository at this point in the history
…shown (#9477)
  • Loading branch information
tobrun authored Jul 20, 2017
1 parent c5300eb commit f19c36a
Showing 1 changed file with 6 additions and 11 deletions.
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() {
return infoWindows;
}

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

0 comments on commit f19c36a

Please sign in to comment.