diff --git a/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt b/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt index 63f29801..d69f7f23 100644 --- a/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt +++ b/maps-compose/src/main/java/com/google/maps/android/compose/GoogleMap.kt @@ -16,6 +16,7 @@ package com.google.maps.android.compose import android.content.ComponentCallbacks import android.content.ComponentCallbacks2 +import android.content.Context import android.content.res.Configuration import android.location.Location import android.os.Bundle @@ -46,12 +47,10 @@ import androidx.lifecycle.findViewTreeLifecycleOwner import com.google.android.gms.maps.GoogleMapOptions import com.google.android.gms.maps.LocationSource import com.google.android.gms.maps.MapView - import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.MapColorScheme import com.google.android.gms.maps.model.PointOfInterest import com.google.maps.android.compose.internal.MapsApiAttribution -import com.google.maps.android.compose.meta.AttributionId import com.google.maps.android.ktx.awaitMap import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineStart @@ -105,6 +104,7 @@ public fun GoogleMap( onPOIClick: ((PointOfInterest) -> Unit)? = null, contentPadding: PaddingValues = DefaultMapContentPadding, mapColorScheme: ComposeMapColorScheme? = null, + mapViewFactory: (Context, GoogleMapOptions) -> MapView = ::MapView, content: @Composable @GoogleMapComposable () -> Unit = {}, ) { // When in preview, early return a Box with the received modifier preserving layout @@ -165,7 +165,7 @@ public fun GoogleMap( AndroidView( modifier = modifier, factory = { context -> - MapView(context, googleMapOptionsFactory()).also { mapView -> + mapViewFactory(context, googleMapOptionsFactory()).also { mapView -> val componentCallbacks = object : ComponentCallbacks2 { override fun onConfigurationChanged(newConfig: Configuration) {}