Last active
November 26, 2017 05:13
-
-
Save tolmachevroman/086a739982754cdd20ea35976266896a to your computer and use it in GitHub Desktop.
Medium Post 2. constructMarkerOptions
This file contains hidden or 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
@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