Skip to content
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 @@ -736,7 +736,10 @@ public void remove(Marker m) {
}

/**
* Called before the marker for a ClusterItem is added to the map.
* Called before the marker for a ClusterItem is added to the map. The default implementation
* sets the marker and snippet text based on the respective item text if they are both
* available, otherwise it will set the title if available, and if not it will set the marker
* title to the item snippet text if that is available.
*
* The first time {@link ClusterManager#cluster()} is invoked on a set of items
* {@link #onBeforeClusterItemRendered(ClusterItem, MarkerOptions)} will be called and
Expand All @@ -749,6 +752,14 @@ public void remove(Marker m) {
* @param markerOptions the markerOptions representing the provided item
*/
protected void onBeforeClusterItemRendered(T item, MarkerOptions markerOptions) {
if (item.getTitle() != null && item.getSnippet() != null) {
markerOptions.title(item.getTitle());
markerOptions.snippet(item.getSnippet());
} else if (item.getTitle() != null) {
markerOptions.title(item.getTitle());
} else if (item.getSnippet() != null) {
markerOptions.title(item.getSnippet());
}
}

/**
Expand Down Expand Up @@ -952,14 +963,6 @@ private void perform(MarkerModifier markerModifier) {
} else {
markerOptions.position(item.getPosition());
}
if (!(item.getTitle() == null) && !(item.getSnippet() == null)) {
markerOptions.title(item.getTitle());
markerOptions.snippet(item.getSnippet());
} else if (!(item.getSnippet() == null)) {
markerOptions.title(item.getSnippet());
} else if (!(item.getTitle() == null)) {
markerOptions.title(item.getTitle());
}
onBeforeClusterItemRendered(item, markerOptions);
marker = mClusterManager.getMarkerCollection().addMarker(markerOptions);
markerWithPosition = new MarkerWithPosition(marker);
Expand Down