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
  • Loading branch information
tobrun committed Jul 11, 2017
1 parent 90c61c1 commit c2bd866
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
*/
class InfoWindowManager {

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

private MapboxMap.InfoWindowAdapter infoWindowAdapter;
private boolean allowConcurrentMultipleInfoWindows;

Expand All @@ -31,12 +32,13 @@ class InfoWindowManager {
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 +58,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 c2bd866

Please sign in to comment.