Created
April 10, 2015 10:14
-
-
Save askarsyzdykov/8e4a00d4bcddd051318c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void init() { | |
mClusteringSettings = new ClusteringSettings(); | |
mClusteringSettings.addMarkersDynamically(true); | |
mClusteringSettings.clusterOptionsProvider(new DemoClusterOptionsProvider(getResources())); | |
mClusteringSettings.clusterSize(144); | |
mGoogleMap.setClustering(mClusteringSettings); | |
} | |
private void addMarkers(List<Place> places) { | |
for (Place place : places) { | |
addMarker(place); | |
} | |
} | |
private Marker addMarker(Place place) { | |
Marker marker = mGoogleMap.addMarker(getMarkersOptionsForPlace(place)); | |
marker.setData(place); | |
return marker; | |
} | |
private MarkerOptions getMarkersOptionsForPlace(Place place) { | |
MarkerOptions options = new MarkerOptions(); | |
Context context = getActivity(); | |
int resourceId = context.getResources().getIdentifier(place.getCategory().getMarkerIcon(), "drawable", context.getPackageName()); | |
MarkerOptions opts = options.title(place.getTitle()).position(place.getGooglePoint()); | |
if (resourceId != 0) { | |
opts.icon(BitmapDescriptorFactory.fromResource(resourceId)); | |
} | |
return opts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment