[android] - avoid creating InfoWindow iterator if no InfoWindows are shown (#9477)

This commit is contained in:
Tobrun
2017-07-20 10:18:40 +02:00
committed by GitHub
parent c5300ebabf
commit f19c36a4ba

View File

@@ -22,7 +22,8 @@ import java.util.List;
*/
class InfoWindowManager {
private List<InfoWindow> infoWindows;
private final List<InfoWindow> infoWindows = new ArrayList<>();
private MapboxMap.InfoWindowAdapter infoWindowAdapter;
private boolean allowConcurrentMultipleInfoWindows;
@@ -30,13 +31,11 @@ class InfoWindowManager {
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();
}
}
}
@@ -56,10 +55,6 @@ class InfoWindowManager {
return allowConcurrentMultipleInfoWindows;
}
List<InfoWindow> getInfoWindows() {
return infoWindows;
}
boolean isInfoWindowValidForMarker(@NonNull Marker marker) {
return !TextUtils.isEmpty(marker.getTitle()) || !TextUtils.isEmpty(marker.getSnippet());
}