Skip to content

Instantly share code, notes, and snippets.

@utsmannn
Created June 28, 2020 05:17
Show Gist options
  • Save utsmannn/60bb22d0dd9ed5291cfa564b57d83b03 to your computer and use it in GitHub Desktop.
Save utsmannn/60bb22d0dd9ed5291cfa564b57d83b03 to your computer and use it in GitHub Desktop.
map.setOnCameraIdleListener {
val newPosition = map.cameraPosition.target
if (newPosition != oldPosition) {
// drag ended
icon_marker.animate().translationY(0f).start()
icon_marker_shadow.animate().withStartAction {
icon_marker_shadow.setPadding(0)
}.start()
getLocation(newPosition) { item ->
bottomSheet.state = BottomSheetBehavior.STATE_COLLAPSED
val position = item.position
val findLocation = LatLng(position.lat, position.lng)
map.animateCamera(CameraUpdateFactory.newLatLng(findLocation), 200,
object : GoogleMap.CancelableCallback {
override fun onFinish() {
hasFetch = true
animateMarker = true
}
override fun onCancel() {
animateMarker = true
}
})
val titlePlace = item.title
val address = item.address.label
text_title.text = titlePlace
text_address.text = address
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment