Created
June 28, 2020 05:12
-
-
Save utsmannn/e1ebce5b59da7a70f7d85dfc7846c7c8 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 getLocation(latLng: LatLng, done: (Item) -> Unit) { | |
val at = "${latLng.latitude},${latLng.longitude}" | |
if (!hasFetch) { | |
animateMarker = false | |
progress_circular.visibility = View.VISIBLE | |
GlobalScope.launch { | |
try { | |
val places = retrofitInstance.getLocation(at).items | |
runOnUiThread { | |
if (places.isNotEmpty()) { | |
progress_circular.visibility = View.GONE | |
done.invoke(places.first()) | |
} | |
} | |
} catch (e: Throwable) { | |
e.printStackTrace() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment