add more optimalization and speed mareker
This commit is contained in:
@@ -53,11 +53,17 @@ private fun fetchHaukPosition(haukUrl: String, callee: Activity) {
|
||||
val lat = hauk_response.points.last()?.getOrNull(0)
|
||||
val lon = hauk_response.points.last()?.getOrNull(1)
|
||||
if (lat != null && lon != null) {
|
||||
HaukMainHandler.post {
|
||||
mapState.moveMarker("target_position", x = longitudeToXNormalized(lon), y = latitudeToYNormalized(lat))
|
||||
}
|
||||
HaukMainHandler.post {
|
||||
try {
|
||||
mapState.moveMarker("target_position", x = longitudeToXNormalized(lon), y = latitudeToYNormalized(lat))
|
||||
} catch (e: Exception) {
|
||||
// Marker might not exist yet, ignore
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(callee, "TARGET LOCATION NOT AVAILABLE", Toast.LENGTH_SHORT).show()
|
||||
HaukMainHandler.post {
|
||||
Toast.makeText(callee, "TARGET LOCATION NOT AVAILABLE", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}}
|
||||
} catch (e: Exception) {
|
||||
// Post UI update to main thread
|
||||
|
||||
Reference in New Issue
Block a user