Fix a crash in old MapDialog introduced due to updated google maps sdk
This commit is contained in:
@@ -42,6 +42,7 @@ import com.google.maps.android.compose.MarkerInfoWindow
|
|||||||
import com.google.maps.android.compose.MarkerState
|
import com.google.maps.android.compose.MarkerState
|
||||||
import com.google.maps.android.compose.MapUiSettings
|
import com.google.maps.android.compose.MapUiSettings
|
||||||
import com.google.maps.android.compose.rememberCameraPositionState
|
import com.google.maps.android.compose.rememberCameraPositionState
|
||||||
|
import com.google.maps.android.compose.MapEffect
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.tasks.await
|
import kotlinx.coroutines.tasks.await
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
@@ -136,15 +137,6 @@ fun MapDialog(
|
|||||||
} else forn = emptyList()
|
} else forn = emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(myLat, myLon) {
|
|
||||||
val lat = myLat; val lon = myLon
|
|
||||||
if (lat != null && lon != null) {
|
|
||||||
camState.animate(
|
|
||||||
CameraUpdateFactory.newLatLngZoom(LatLng(lat, lon), 16f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onClose,
|
onDismissRequest = onClose,
|
||||||
title = { Text("Karta") },
|
title = { Text("Karta") },
|
||||||
@@ -168,6 +160,13 @@ fun MapDialog(
|
|||||||
compassEnabled = true
|
compassEnabled = true
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
MapEffect(myLat, myLon) { map ->
|
||||||
|
val lat = myLat; val lon = myLon
|
||||||
|
if (lat != null && lon != null) {
|
||||||
|
map.animateCamera(CameraUpdateFactory.newLatLngZoom(LatLng(lat, lon), 16f))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val lat = myLat; val lon = myLon
|
val lat = myLat; val lon = myLon
|
||||||
if (showKlotter) {
|
if (showKlotter) {
|
||||||
klotter.forEach { n ->
|
klotter.forEach { n ->
|
||||||
|
|||||||
Reference in New Issue
Block a user