Skip to content

Instantly share code, notes, and snippets.

@tolmachevroman
Last active November 26, 2017 05:13
Show Gist options
  • Save tolmachevroman/086a739982754cdd20ea35976266896a to your computer and use it in GitHub Desktop.
Save tolmachevroman/086a739982754cdd20ea35976266896a to your computer and use it in GitHub Desktop.
Medium Post 2. constructMarkerOptions
@Inject lateinit var utils: Utils
private fun constructMarkerOptions(restaurant: Restaurant): MarkerOptions {
val point = LatLng(restaurant.lat, restaurant.lng)
val icon = when (restaurant.cuisine) {
1 -> BitmapDescriptorFactory.fromBitmap(utils.getBitmap(R.drawable.ic_peru))
2 -> BitmapDescriptorFactory.fromBitmap(utils.getBitmap(R.drawable.ic_italy))
3 -> BitmapDescriptorFactory.fromBitmap(utils.getBitmap(R.drawable.ic_chile))
else -> null
}
//snippet to distinguish markers within UiAutomator
return MarkerOptions().snippet("cuisine:${restaurant.cuisine}").position(point).title(restaurant.name).icon(icon)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment