add more optimalization and speed mareker

This commit is contained in:
2026-02-13 12:28:19 +01:00
parent 67fea51949
commit 0e2208d104
4 changed files with 109 additions and 48 deletions
@@ -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