@ -46,14 +46,14 @@ import androidx.compose.ui.platform.LocalLifecycleOwner
@@ -46,14 +46,14 @@ import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import com.mapbox.mapboxsdk.Mapbox
import com.mapbox.mapboxsdk.maps.MapView
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager
import kotlinx.collections.immutable.ImmutableMap
import kotlinx.collections.immutable.persistentMapOf
import kotlinx.coroutines.awaitCancellation
import org.maplibre.android.MapLibre
import org.maplibre.android.maps.MapLibreMap
import org.maplibre.android.maps.MapView
import org.maplibre.android.maps.Style
import org.maplibre.android.plugins.annotation.SymbolManager
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
@ -63,7 +63,7 @@ import kotlin.coroutines.suspendCoroutine
@@ -63,7 +63,7 @@ import kotlin.coroutines.suspendCoroutine
* Heavily inspired by https : //github.com/googlemaps/android-maps-compose
*
* @param styleUri a URI where to asynchronously fetch a style for the map
* @param modifier Modifier to be applied to the Mapbox Map
* @param modifier Modifier to be applied to the MapLibre Map
* @param images images added to the map ' s style to be later used with [ Symbol ]
* @param cameraPositionState the [ CameraPositionState ] to be used to control or observe the map ' s
* camera state
@ -73,7 +73,7 @@ import kotlin.coroutines.suspendCoroutine
@@ -73,7 +73,7 @@ import kotlin.coroutines.suspendCoroutine
* @param content the content of the map
* /
@Composable
public fun Mapbox Map (
public fun MapLibre Map (
styleUri : String ,
modifier : Modifier = Modifier ,
images : ImmutableMap < String , Int > = persistentMapOf ( ) ,
@ -82,7 +82,7 @@ public fun MapboxMap(
@@ -82,7 +82,7 @@ public fun MapboxMap(
symbolManagerSettings : MapSymbolManagerSettings = DefaultMapSymbolManagerSettings ,
locationSettings : MapLocationSettings = DefaultMapLocationSettings ,
content : (
@Composable @Mapbox MapComposable
@Composable @MapLibre MapComposable
( ) -> Unit
) ? = null ,
) {
@ -99,7 +99,7 @@ public fun MapboxMap(
@@ -99,7 +99,7 @@ public fun MapboxMap(
val context = LocalContext . current
val mapView = remember {
Mapbox . getInstance ( context )
MapLibre . getInstance ( context )
MapView ( context )
}
@ -168,13 +168,13 @@ private suspend inline fun CompositionContext.newComposition(
@@ -168,13 +168,13 @@ private suspend inline fun CompositionContext.newComposition(
}
}
private suspend inline fun MapView . awaitMap ( ) : Mapbox Map = suspendCoroutine { continuation ->
private suspend inline fun MapView . awaitMap ( ) : MapLibre Map = suspendCoroutine { continuation ->
getMapAsync { map ->
continuation . resume ( map )
}
}
private suspend inline fun Mapbox Map . awaitStyle (
private suspend inline fun MapLibre Map . awaitStyle (
context : Context ,
styleUri : String ,
images : ImmutableMap < String , Int > ,
@ -227,7 +227,7 @@ private fun MapView.lifecycleObserver(previousState: MutableState<Lifecycle.Even
@@ -227,7 +227,7 @@ private fun MapView.lifecycleObserver(previousState: MutableState<Lifecycle.Even
when ( event ) {
Lifecycle . Event . ON _CREATE -> {
// Skip calling mapView.onCreate if the lifecycle did not go through onDestroy - in
// this case the Mapbox Map composable also doesn't leave the composition. So,
// this case the MapLibre Map composable also doesn't leave the composition. So,
// recreating the map does not restore state properly which must be avoided.
if ( previousState . value != Lifecycle . Event . ON _STOP ) {
this . onCreate ( Bundle ( ) )