Created
June 28, 2020 05:17
-
-
Save utsmannn/60bb22d0dd9ed5291cfa564b57d83b03 to your computer and use it in GitHub Desktop.
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
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