Created
August 11, 2020 09:05
-
-
Save yektasarioglu/7d9d8ab19689d6fb77895315bc22e420 to your computer and use it in GitHub Desktop.
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
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