Created
January 6, 2019 09:24
-
-
Save mizutori/a593e5c5628651935316e2ee3d995f02 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
private fun zoomMapTo(location: Location) { | |
val latLng = LatLng(location.latitude, location.longitude) | |
if (this.didInitialZoom == false) { | |
try { | |
map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 17.5f)) | |
this.didInitialZoom = true | |
return | |
} catch (e: Exception) { | |
e.printStackTrace() | |
} | |
//Toast.makeText(this.getActivity(), "Inital zoom in process", Toast.LENGTH_LONG).show(); | |
} | |
if (zoomable) { | |
try { | |
zoomable = false | |
map.animateCamera(CameraUpdateFactory.newLatLng(latLng), | |
object : GoogleMap.CancelableCallback { | |
override fun onFinish() { | |
zoomable = true | |
} | |
override fun onCancel() { | |
zoomable = true | |
} | |
}) | |
} catch (e: Exception) { | |
e.printStackTrace() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment