Skip to content

Instantly share code, notes, and snippets.

@yektasarioglu
Created August 11, 2020 09:05
Show Gist options
  • Save yektasarioglu/7d9d8ab19689d6fb77895315bc22e420 to your computer and use it in GitHub Desktop.
Save yektasarioglu/7d9d8ab19689d6fb77895315bc22e420 to your computer and use it in GitHub Desktop.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeUIElements()
with (viewModel) {
initialize(this@HomeActivity)
initializeStyle(theme = currentTheme)
isCoordinateAvailable.observe(this@HomeActivity, Observer {
viewModel.moveCameraToCurrentLocation()
viewModel.drawCirclePivotalToCurrentLocation()
})
nearbyHealthInstitutionSites.observe(this@HomeActivity, Observer {
Log.i("HomeActivity", "nearbyHealthInstitutionSites -> $it")
it.forEach { site->
Log.i(TAG, "site's lat and long: ${site.location.lat}, ${site.location.lng}")
viewModel.markTheSite(site = site, distanceText = resources.getString(R.string.distance))
}
viewModel.setOnMarkerClickListener { marker ->
toast("Clicked ${marker.title}")
with (binding.actionsMenu) {
root.visibility = View.VISIBLE
}
}
toast(getString(R.string.scroll_to_see_more))
})
}
mapView = binding.mapView
mapView.onCreate(savedInstanceState)
mapView.getMapAsync(viewModel.getOnMapReadyCallback())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment