Created
September 7, 2017 02:32
-
-
Save josh-burton/215c6611b328b97fa11f30c28a8c7bd4 to your computer and use it in GitHub Desktop.
MapMe Kotlin Adapter
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
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