Skip to content

Instantly share code, notes, and snippets.

@josh-burton
Created September 7, 2017 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josh-burton/215c6611b328b97fa11f30c28a8c7bd4 to your computer and use it in GitHub Desktop.
Save josh-burton/215c6611b328b97fa11f30c28a8c7bd4 to your computer and use it in GitHub Desktop.
MapMe Kotlin Adapter
class MapsAdapter(context: Context, private val markers: List<MarkerData>) : GoogleMapMeAdapter(context) {
fun onCreateAnnotation(factory: AnnotationFactory, position: Int, annotationType: Int): MapAnnotation {
val item = this.markers[position]
return factory.createMarker(item.getLatLng(), null, item.getTitle())
}
fun onBindAnnotation(annotation: MapAnnotation, position: Int, payload: Any) {
if (annotation is MarkerAnnotation) {
val item = this.markers[position]
annotation.setTitle(item.getTitle())
}
}
val itemCount: Int
get() = markers.size()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment