-
- All Implemented Interfaces:
-
com.google.maps.android.clustering.view.ClusterRenderer
public class ClusterRendererMultipleItems<T extends ClusterItem> implements ClusterRenderer<T>
The default view for a ClusterManager. Markers are animated in and out of clusters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumClusterRendererMultipleItems.AnimationType
-
Constructor Summary
Constructors Constructor Description ClusterRendererMultipleItems(Context context, GoogleMap map, ClusterManager<T> clusterManager)
-
Method Summary
Modifier and Type Method Description voidsetAnimationType(ClusterRendererMultipleItems.AnimationType type)voidsetAnimationInterpolator(TimeInterpolator interpolator)Sets the interpolator for the animation. voidonAdd()Called when the view is added. voidonRemove()Called when the view is removed. intgetColor(int clusterSize)Called to determine the color of a Cluster. intgetClusterTextAppearance(int clusterSize)Called to determine the text appearance of a cluster. voidsetLoggingEnabled(boolean enabled)Enables or disables logging for the cluster renderer. intgetMinClusterSize()Gets the minimum cluster size used to render clusters. voidsetMinClusterSize(int minClusterSize)Sets the minimum cluster size used to render clusters. voidonClustersChanged(Set<out Cluster<T>> clusters)Called when the view needs to be updated because new clusters need to be displayed. voidsetOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener)voidsetOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener)voidsetOnClusterInfoWindowLongClickListener(ClusterManager.OnClusterInfoWindowLongClickListener<T> listener)voidsetOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener)voidsetOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener)voidsetOnClusterItemInfoWindowLongClickListener(ClusterManager.OnClusterItemInfoWindowLongClickListener<T> listener)voidsetAnimation(boolean animate)Called to set animation on or off voidsetAnimationDuration(long animationDurationMs)Sets the length of the animation in milliseconds. voidstopAnimation()MarkergetMarker(T clusterItem)Get the marker from a ClusterItem TgetClusterItem(Marker marker)Get the ClusterItem from a marker MarkergetMarker(Cluster<T> cluster)Get the marker from a Cluster Cluster<T>getCluster(Marker marker)Get the Cluster from a marker -
-
Constructor Detail
-
ClusterRendererMultipleItems
ClusterRendererMultipleItems(Context context, GoogleMap map, ClusterManager<T> clusterManager)
-
-
Method Detail
-
setAnimationType
void setAnimationType(ClusterRendererMultipleItems.AnimationType type)
-
setAnimationInterpolator
void setAnimationInterpolator(TimeInterpolator interpolator)
Sets the interpolator for the animation.
- Parameters:
interpolator- the interpolator to use for the animation.
-
onAdd
void onAdd()
Called when the view is added.
-
onRemove
void onRemove()
Called when the view is removed.
-
getColor
int getColor(int clusterSize)
Called to determine the color of a Cluster.
-
getClusterTextAppearance
@StyleRes() int getClusterTextAppearance(int clusterSize)
Called to determine the text appearance of a cluster.
-
setLoggingEnabled
void setLoggingEnabled(boolean enabled)
Enables or disables logging for the cluster renderer.
When enabled, the renderer will log internal operations such as cluster rendering,marker updates, and other debug information. This is useful for development and debugging,but should typically be disabled in production builds.
- Parameters:
enabled-{@code true}to enable logging;{@code false}to disable it.
-
getMinClusterSize
int getMinClusterSize()
Gets the minimum cluster size used to render clusters. For example, if "4" is returned,then for any clusters of size 3 or less the items will be rendered as individual markersinstead of as a single cluster marker.
-
setMinClusterSize
void setMinClusterSize(int minClusterSize)
Sets the minimum cluster size used to render clusters. For example, if "4" is provided,then for any clusters of size 3 or less the items will be rendered as individual markersinstead of as a single cluster marker.
- Parameters:
minClusterSize- the minimum cluster size used to render clusters.
-
onClustersChanged
void onClustersChanged(Set<out Cluster<T>> clusters)
Called when the view needs to be updated because new clusters need to be displayed.
- Parameters:
clusters- the clusters to be displayed.
-
setOnClusterClickListener
void setOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener)
-
setOnClusterInfoWindowClickListener
void setOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener)
-
setOnClusterInfoWindowLongClickListener
void setOnClusterInfoWindowLongClickListener(ClusterManager.OnClusterInfoWindowLongClickListener<T> listener)
-
setOnClusterItemClickListener
void setOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener)
-
setOnClusterItemInfoWindowClickListener
void setOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener)
-
setOnClusterItemInfoWindowLongClickListener
void setOnClusterItemInfoWindowLongClickListener(ClusterManager.OnClusterItemInfoWindowLongClickListener<T> listener)
-
setAnimation
void setAnimation(boolean animate)
Called to set animation on or off
-
setAnimationDuration
void setAnimationDuration(long animationDurationMs)
Sets the length of the animation in milliseconds. The default duration is 300 milliseconds.
- Parameters:
animationDurationMs- long: The length of the animation, in milliseconds.
-
stopAnimation
void stopAnimation()
-
getMarker
Marker getMarker(T clusterItem)
Get the marker from a ClusterItem
- Parameters:
clusterItem- ClusterItem which you will obtain its marker
-
getClusterItem
T getClusterItem(Marker marker)
Get the ClusterItem from a marker
- Parameters:
marker- which you will obtain its ClusterItem
-
getMarker
Marker getMarker(Cluster<T> cluster)
Get the marker from a Cluster
- Parameters:
cluster- which you will obtain its marker
-
getCluster
Cluster<T> getCluster(Marker marker)
Get the Cluster from a marker
- Parameters:
marker- which you will obtain its Cluster
-
-
-
-