Skip to content

Instantly share code, notes, and snippets.

@utsmannn
Last active June 27, 2020 21:40
Show Gist options
  • Save utsmannn/452f959112cef9b70f31c97b068b643a to your computer and use it in GitHub Desktop.
Save utsmannn/452f959112cef9b70f31c97b068b643a to your computer and use it in GitHub Desktop.
(map_view as SupportMapFragment).getMapAsync { map ->
map.moveCamera(CameraUpdateFactory.newLatLngZoom(jakartaLatLng, 18f))
val oldPosition = map.cameraPosition.target
map.setOnCameraMoveStartedListener {
// drag started
// start animation
icon_marker.animate().translationY(-50f).start()
icon_marker_shadow.animate().withStartAction {
icon_marker_shadow.setPadding(10)
}.start()
}
map.setOnCameraIdleListener {
val newPosition = map.cameraPosition.target
if (newPosition != oldPosition) {
// drag ended
// start animation
icon_marker.animate().translationY(0f).start()
icon_marker_shadow.animate().withStartAction {
icon_marker_shadow.setPadding(0)
}.start()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment