Browse Source

Merge pull request #2838 from element-hq/renovate/org.maplibre.gl-android-sdk-11.x

Update dependency org.maplibre.gl:android-sdk to v11
pull/2952/head
ganfra 4 months ago committed by GitHub
parent
commit
324ff4f03e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/MapDefaults.kt
  2. 6
      features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt
  3. 8
      features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt
  4. 2
      features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationViewTest.kt
  5. 6
      gradle/libs.versions.toml
  6. 2
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMode.kt
  7. 12
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMoveStartedReason.kt
  8. 18
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraPositionState.kt
  9. 2
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/IconAnchor.kt
  10. 8
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapApplier.kt
  11. 24
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMap.kt
  12. 8
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMapComposable.kt
  13. 14
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapUpdater.kt
  14. 10
      libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/Symbol.kt

4
features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/MapDefaults.kt

@ -21,12 +21,12 @@ import android.view.Gravity
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import com.mapbox.mapboxsdk.camera.CameraPosition
import com.mapbox.mapboxsdk.geometry.LatLng
import io.element.android.compound.theme.ElementTheme import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.maplibre.compose.MapLocationSettings import io.element.android.libraries.maplibre.compose.MapLocationSettings
import io.element.android.libraries.maplibre.compose.MapSymbolManagerSettings import io.element.android.libraries.maplibre.compose.MapSymbolManagerSettings
import io.element.android.libraries.maplibre.compose.MapUiSettings import io.element.android.libraries.maplibre.compose.MapUiSettings
import org.maplibre.android.camera.CameraPosition
import org.maplibre.android.geometry.LatLng
/** /**
* Common configuration values for the map. * Common configuration values for the map.

6
features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt

@ -37,7 +37,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.mapbox.mapboxsdk.camera.CameraPosition
import io.element.android.compound.theme.ElementTheme import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.location.api.Location import io.element.android.features.location.api.Location
@ -61,9 +60,10 @@ import io.element.android.libraries.designsystem.theme.components.bottomsheet.re
import io.element.android.libraries.designsystem.utils.CommonDrawables import io.element.android.libraries.designsystem.utils.CommonDrawables
import io.element.android.libraries.maplibre.compose.CameraMode import io.element.android.libraries.maplibre.compose.CameraMode
import io.element.android.libraries.maplibre.compose.CameraMoveStartedReason import io.element.android.libraries.maplibre.compose.CameraMoveStartedReason
import io.element.android.libraries.maplibre.compose.MapboxMap import io.element.android.libraries.maplibre.compose.MapLibreMap
import io.element.android.libraries.maplibre.compose.rememberCameraPositionState import io.element.android.libraries.maplibre.compose.rememberCameraPositionState
import io.element.android.libraries.ui.strings.CommonStrings import io.element.android.libraries.ui.strings.CommonStrings
import org.maplibre.android.camera.CameraPosition
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@ -189,7 +189,7 @@ fun SendLocationView(
.consumeWindowInsets(it), .consumeWindowInsets(it),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
MapboxMap( MapLibreMap(
styleUri = rememberTileStyleUrl(), styleUri = rememberTileStyleUrl(),
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState, cameraPositionState = cameraPositionState,

8
features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt

@ -33,8 +33,6 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.mapbox.mapboxsdk.camera.CameraPosition
import com.mapbox.mapboxsdk.geometry.LatLng
import io.element.android.compound.theme.ElementTheme import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.compound.tokens.generated.TypographyTokens import io.element.android.compound.tokens.generated.TypographyTokens
@ -56,12 +54,14 @@ import io.element.android.libraries.designsystem.utils.CommonDrawables
import io.element.android.libraries.maplibre.compose.CameraMode import io.element.android.libraries.maplibre.compose.CameraMode
import io.element.android.libraries.maplibre.compose.CameraMoveStartedReason import io.element.android.libraries.maplibre.compose.CameraMoveStartedReason
import io.element.android.libraries.maplibre.compose.IconAnchor import io.element.android.libraries.maplibre.compose.IconAnchor
import io.element.android.libraries.maplibre.compose.MapboxMap import io.element.android.libraries.maplibre.compose.MapLibreMap
import io.element.android.libraries.maplibre.compose.Symbol import io.element.android.libraries.maplibre.compose.Symbol
import io.element.android.libraries.maplibre.compose.rememberCameraPositionState import io.element.android.libraries.maplibre.compose.rememberCameraPositionState
import io.element.android.libraries.maplibre.compose.rememberSymbolState import io.element.android.libraries.maplibre.compose.rememberSymbolState
import io.element.android.libraries.ui.strings.CommonStrings import io.element.android.libraries.ui.strings.CommonStrings
import kotlinx.collections.immutable.toImmutableMap import kotlinx.collections.immutable.toImmutableMap
import org.maplibre.android.camera.CameraPosition
import org.maplibre.android.geometry.LatLng
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@ -166,7 +166,7 @@ fun ShowLocationView(
) )
} }
MapboxMap( MapLibreMap(
styleUri = rememberTileStyleUrl(), styleUri = rememberTileStyleUrl(),
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
images = mapOf(PIN_ID to CommonDrawables.pin).toImmutableMap(), images = mapOf(PIN_ID to CommonDrawables.pin).toImmutableMap(),

2
features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationViewTest.kt

@ -144,7 +144,7 @@ private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setShowL
onBackClick: () -> Unit = EnsureNeverCalled(), onBackClick: () -> Unit = EnsureNeverCalled(),
) { ) {
setContent { setContent {
// Simulate a LocalInspectionMode for MapboxMap // Simulate a LocalInspectionMode for MapLibreMap
CompositionLocalProvider(LocalInspectionMode provides true) { CompositionLocalProvider(LocalInspectionMode provides true) {
ShowLocationView( ShowLocationView(
state = state, state = state,

6
gradle/libs.versions.toml

@ -170,9 +170,9 @@ vanniktech_blurhash = "com.vanniktech:blurhash:0.3.0"
telephoto_zoomableimage = { module = "me.saket.telephoto:zoomable-image-coil", version.ref = "telephoto" } telephoto_zoomableimage = { module = "me.saket.telephoto:zoomable-image-coil", version.ref = "telephoto" }
telephoto_flick = { module = "me.saket.telephoto:flick-android", version.ref = "telephoto" } telephoto_flick = { module = "me.saket.telephoto:flick-android", version.ref = "telephoto" }
statemachine = "com.freeletics.flowredux:compose:1.2.1" statemachine = "com.freeletics.flowredux:compose:1.2.1"
maplibre = "org.maplibre.gl:android-sdk:10.3.1" maplibre = "org.maplibre.gl:android-sdk:11.0.0"
maplibre_ktx = "org.maplibre.gl:android-sdk-ktx-v7:2.0.2" maplibre_ktx = "org.maplibre.gl:android-sdk-ktx-v7:3.0.0"
maplibre_annotation = "org.maplibre.gl:android-plugin-annotation-v9:2.0.2" maplibre_annotation = "org.maplibre.gl:android-plugin-annotation-v9:3.0.0"
opusencoder = "io.element.android:opusencoder:1.1.0" opusencoder = "io.element.android:opusencoder:1.1.0"
kotlinpoet = "com.squareup:kotlinpoet:1.17.0" kotlinpoet = "com.squareup:kotlinpoet:1.17.0"

2
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMode.kt

@ -19,7 +19,7 @@
package io.element.android.libraries.maplibre.compose package io.element.android.libraries.maplibre.compose
import androidx.compose.runtime.Immutable import androidx.compose.runtime.Immutable
import com.mapbox.mapboxsdk.location.modes.CameraMode as InternalCameraMode import org.maplibre.android.location.modes.CameraMode as InternalCameraMode
@Immutable @Immutable
public enum class CameraMode { public enum class CameraMode {

12
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMoveStartedReason.kt

@ -19,14 +19,14 @@
package io.element.android.libraries.maplibre.compose package io.element.android.libraries.maplibre.compose
import androidx.compose.runtime.Immutable import androidx.compose.runtime.Immutable
import com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_API_ANIMATION import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_API_ANIMATION
import com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_API_GESTURE import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_API_GESTURE
import com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION
/** /**
* Enumerates the different reasons why the map camera started to move. * Enumerates the different reasons why the map camera started to move.
* *
* Based on enum values from https://docs.maptiler.com/maplibre-gl-native-android/com.mapbox.mapboxsdk.maps/#oncameramovestartedlistener. * Based on enum values from https://docs.maptiler.com/maplibre-gl-native-android/org.maplibre.android.maps/#oncameramovestartedlistener.
* *
* [NO_MOVEMENT_YET] is used as the initial state before any map movement has been observed. * [NO_MOVEMENT_YET] is used as the initial state before any map movement has been observed.
* *
@ -44,11 +44,11 @@ public enum class CameraMoveStartedReason(public val value: Int) {
public companion object { public companion object {
/** /**
* Converts from the Maps SDK [com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener] * Converts from the Maps SDK [org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener]
* constants to [CameraMoveStartedReason], or returns [UNKNOWN] if there is no such * constants to [CameraMoveStartedReason], or returns [UNKNOWN] if there is no such
* [CameraMoveStartedReason] for the given [value]. * [CameraMoveStartedReason] for the given [value].
* *
* See https://docs.maptiler.com/maplibre-gl-native-android/com.mapbox.mapboxsdk.maps/#oncameramovestartedlistener. * See https://docs.maptiler.com/maplibre-gl-native-android/org.maplibre.android.maps/#oncameramovestartedlistener.
*/ */
public fun fromInt(value: Int): CameraMoveStartedReason { public fun fromInt(value: Int): CameraMoveStartedReason {
return values().firstOrNull { it.value == value } ?: return UNKNOWN return values().firstOrNull { it.value == value } ?: return UNKNOWN

18
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraPositionState.kt

@ -28,11 +28,11 @@ import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.runtime.staticCompositionLocalOf
import com.mapbox.mapboxsdk.camera.CameraPosition
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Projection
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
import org.maplibre.android.camera.CameraPosition
import org.maplibre.android.camera.CameraUpdateFactory
import org.maplibre.android.maps.MapLibreMap
import org.maplibre.android.maps.Projection
/** /**
* Create and [rememberSaveable] a [CameraPositionState] using [CameraPositionState.Saver]. * Create and [rememberSaveable] a [CameraPositionState] using [CameraPositionState.Saver].
@ -49,7 +49,7 @@ public inline fun rememberCameraPositionState(
/** /**
* A state object that can be hoisted to control and observe the map's camera state. * A state object that can be hoisted to control and observe the map's camera state.
* A [CameraPositionState] may only be used by a single [MapboxMap] composable at a time * A [CameraPositionState] may only be used by a single [MapLibreMap] composable at a time
* as it reflects instance state for a single view of a map. * as it reflects instance state for a single view of a map.
* *
* @param position the initial camera position * @param position the initial camera position
@ -143,15 +143,15 @@ public class CameraPositionState(
// The map currently associated with this CameraPositionState. // The map currently associated with this CameraPositionState.
// Guarded by `lock`. // Guarded by `lock`.
private var map: MapboxMap? by mutableStateOf(null) private var map: MapLibreMap? by mutableStateOf(null)
// The current map is set and cleared by side effect. // The current map is set and cleared by side effect.
// There can be only one associated at a time. // There can be only one associated at a time.
internal fun setMap(map: MapboxMap?) { internal fun setMap(map: MapLibreMap?) {
synchronized(lock) { synchronized(lock) {
if (this.map == null && map == null) return if (this.map == null && map == null) return
if (this.map != null && map != null) { if (this.map != null && map != null) {
error("CameraPositionState may only be associated with one MapboxMap at a time") error("CameraPositionState may only be associated with one MapLibreMap at a time")
} }
this.map = map this.map = map
if (map == null) { if (map == null) {
@ -179,7 +179,7 @@ internal val LocalCameraPositionState = staticCompositionLocalOf { CameraPositio
/** The current [CameraPositionState] used by the map. */ /** The current [CameraPositionState] used by the map. */
public val currentCameraPositionState: CameraPositionState public val currentCameraPositionState: CameraPositionState
@[MapboxMapComposable ReadOnlyComposable Composable] @[MapLibreMapComposable ReadOnlyComposable Composable]
get() = LocalCameraPositionState.current get() = LocalCameraPositionState.current
@Parcelize @Parcelize

2
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/IconAnchor.kt

@ -19,7 +19,7 @@
package io.element.android.libraries.maplibre.compose package io.element.android.libraries.maplibre.compose
import androidx.compose.runtime.Immutable import androidx.compose.runtime.Immutable
import com.mapbox.mapboxsdk.style.layers.Property import org.maplibre.android.style.layers.Property
@Immutable @Immutable
public enum class IconAnchor { public enum class IconAnchor {

8
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapApplier.kt

@ -19,9 +19,9 @@
package io.element.android.libraries.maplibre.compose package io.element.android.libraries.maplibre.compose
import androidx.compose.runtime.AbstractApplier import androidx.compose.runtime.AbstractApplier
import com.mapbox.mapboxsdk.maps.MapboxMap import org.maplibre.android.maps.MapLibreMap
import com.mapbox.mapboxsdk.maps.Style import org.maplibre.android.maps.Style
import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager import org.maplibre.android.plugins.annotation.SymbolManager
internal interface MapNode { internal interface MapNode {
fun onAttached() {} fun onAttached() {}
@ -32,7 +32,7 @@ internal interface MapNode {
private object MapNodeRoot : MapNode private object MapNodeRoot : MapNode
internal class MapApplier( internal class MapApplier(
val map: MapboxMap, val map: MapLibreMap,
val style: Style, val style: Style,
val symbolManager: SymbolManager, val symbolManager: SymbolManager,
) : AbstractApplier<MapNode>(MapNodeRoot) { ) : AbstractApplier<MapNode>(MapNodeRoot) {

24
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMap.kt → libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMap.kt

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

8
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMapComposable.kt → libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMapComposable.kt

@ -22,10 +22,10 @@ import androidx.compose.runtime.ComposableTargetMarker
/** /**
* An annotation that can be used to mark a composable function as being expected to be use in a * An annotation that can be used to mark a composable function as being expected to be use in a
* composable function that is also marked or inferred to be marked as a [MapboxMapComposable]. * composable function that is also marked or inferred to be marked as a [MapLibreMapComposable].
* *
* This will produce build warnings when [MapboxMapComposable] composable functions are used outside * This will produce build warnings when [MapLibreMapComposable] composable functions are used outside
* of a [MapboxMapComposable] content lambda, and vice versa. * of a [MapLibreMapComposable] content lambda, and vice versa.
*/ */
@Retention(AnnotationRetention.BINARY) @Retention(AnnotationRetention.BINARY)
@ComposableTargetMarker(description = "MapLibre Map Composable") @ComposableTargetMarker(description = "MapLibre Map Composable")
@ -36,4 +36,4 @@ import androidx.compose.runtime.ComposableTargetMarker
AnnotationTarget.TYPE, AnnotationTarget.TYPE,
AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE_PARAMETER,
) )
public annotation class MapboxMapComposable public annotation class MapLibreMapComposable

14
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapUpdater.kt

@ -26,17 +26,17 @@ import androidx.compose.runtime.ComposeNode
import androidx.compose.runtime.currentComposer import androidx.compose.runtime.currentComposer
import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions import org.maplibre.android.location.LocationComponentActivationOptions
import com.mapbox.mapboxsdk.location.LocationComponentOptions import org.maplibre.android.location.LocationComponentOptions
import com.mapbox.mapboxsdk.location.OnCameraTrackingChangedListener import org.maplibre.android.location.OnCameraTrackingChangedListener
import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest import org.maplibre.android.location.engine.LocationEngineRequest
import com.mapbox.mapboxsdk.maps.MapboxMap import org.maplibre.android.maps.MapLibreMap
import com.mapbox.mapboxsdk.maps.Style import org.maplibre.android.maps.Style
private const val LOCATION_REQUEST_INTERVAL = 750L private const val LOCATION_REQUEST_INTERVAL = 750L
internal class MapPropertiesNode( internal class MapPropertiesNode(
val map: MapboxMap, val map: MapLibreMap,
style: Style, style: Style,
context: Context, context: Context,
cameraPositionState: CameraPositionState, cameraPositionState: CameraPositionState,

10
libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/Symbol.kt

@ -26,10 +26,10 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.Saver import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import com.mapbox.mapboxsdk.geometry.LatLng import org.maplibre.android.geometry.LatLng
import com.mapbox.mapboxsdk.plugins.annotation.Symbol import org.maplibre.android.plugins.annotation.Symbol
import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager import org.maplibre.android.plugins.annotation.SymbolManager
import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions import org.maplibre.android.plugins.annotation.SymbolOptions
internal class SymbolNode( internal class SymbolNode(
val symbolManager: SymbolManager, val symbolManager: SymbolManager,
@ -85,7 +85,7 @@ public fun rememberSymbolState(
* @param iconAnchor the anchor for the symbol image * @param iconAnchor the anchor for the symbol image
*/ */
@Composable @Composable
@MapboxMapComposable @MapLibreMapComposable
public fun Symbol( public fun Symbol(
iconId: String, iconId: String,
state: SymbolState = rememberSymbolState(), state: SymbolState = rememberSymbolState(),

Loading…
Cancel
Save