Skip to content

Commit 6af2863

Browse files
jushgithub-actions[bot]
authored andcommitted
Remove RestrictTo annotation for camera changed coalesced APIs (#3874)
Remove `RestrictTo` annotation for camera changed coalesced APIs. This is a follow-up to: - #3598 - #3562 This PR also updates the example app to use the new coalesced event. More details: https://mapbox.atlassian.net/browse/MAPSAND-2142 cc @mapbox/sdk-ci GitOrigin-RevId: 3239cda70e9977a553a532893b13f936d33a6bb7
1 parent 1a05e81 commit 6af2863

File tree

11 files changed

+58
-37
lines changed

11 files changed

+58
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Mapbox welcomes participation and contributions from everyone.
1313
* Add common `MapInteraction` APIs to `StandardStyleInteractionsState`: `.onFeaturesetClicked`, `.onLayerClicked`, `.onFeaturesetLongClicked`, `.onLayerLongClicked`, `.onMapClicked`, `.onMapLongClicked`.
1414
* Add `StyleInteractionsState` to `MapboxStandardSatelliteStyle` so interactions can be used with the satellite style.
1515
* [compose] Rename experimental `ExperimentalStandardStyleState` to `StandardStyleState`, rename experimental `MapboxStandardStyleExperimental` to `MapboxStandardStyle(styleImportsContent, topSlot, middleSlot, bottomSlot, standardStyleState)`, and deprecate previous `MapboxStandardStyle` composable functions.
16+
* Expose new experimental camera event `MapboxMap.subscribeCameraChangedCoalesced`, `MapboxMap.cameraChangedCoalescedEvents`.
17+
* [compose] Expose new camera event `MapState.cameraChangedCoalescedEvents`
1618

1719
# 11.11.1 May 16, 2025
1820
## Bug fixes 🐞

app/src/main/java/com/mapbox/maps/testapp/examples/InsetMapActivity.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import androidx.appcompat.app.AppCompatActivity
66
import androidx.lifecycle.Lifecycle
77
import androidx.lifecycle.lifecycleScope
88
import androidx.lifecycle.repeatOnLifecycle
9+
import com.mapbox.annotation.MapboxExperimental
910
import com.mapbox.geojson.Feature
1011
import com.mapbox.geojson.LineString
1112
import com.mapbox.geojson.Point
1213
import com.mapbox.maps.*
13-
import com.mapbox.maps.coroutine.cameraChangedEvents
14+
import com.mapbox.maps.coroutine.cameraChangedCoalescedEvents
1415
import com.mapbox.maps.dsl.cameraOptions
1516
import com.mapbox.maps.extension.style.layers.addLayer
1617
import com.mapbox.maps.extension.style.layers.generated.lineLayer
@@ -41,6 +42,7 @@ class InsetMapActivity : AppCompatActivity() {
4142
private lateinit var mainMapboxMap: MapboxMap
4243
private var insetMapboxMap: MapboxMap? = null
4344

45+
@OptIn(MapboxExperimental::class)
4446
override fun onCreate(savedInstanceState: Bundle?) {
4547
super.onCreate(savedInstanceState)
4648
val binding = ActivityInsetMapBinding.inflate(layoutInflater)
@@ -55,8 +57,8 @@ class InsetMapActivity : AppCompatActivity() {
5557
// repeatOnLifecycle launches the block in a new coroutine every time the
5658
// lifecycle is in the STARTED state (or above) and cancels it when it's STOPPED.
5759
repeatOnLifecycle(Lifecycle.State.STARTED) {
58-
mainMapboxMap.cameraChangedEvents.collect {
59-
updateInsetMapCamera(it.cameraState)
60+
mainMapboxMap.cameraChangedCoalescedEvents.collect { cameraEvent ->
61+
updateInsetMapCamera(cameraEvent.cameraState)
6062
}
6163
}
6264
}

app/src/main/java/com/mapbox/maps/testapp/examples/coroutines/featurestate/FeatureStateActivity.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.core.view.doOnLayout
1111
import androidx.lifecycle.Lifecycle
1212
import androidx.lifecycle.lifecycleScope
1313
import androidx.lifecycle.repeatOnLifecycle
14+
import com.mapbox.annotation.MapboxExperimental
1415
import com.mapbox.bindgen.Value
1516
import com.mapbox.geojson.Point
1617
import com.mapbox.maps.MapboxMap
@@ -20,7 +21,7 @@ import com.mapbox.maps.RenderedQueryOptions
2021
import com.mapbox.maps.ScreenBox
2122
import com.mapbox.maps.ScreenCoordinate
2223
import com.mapbox.maps.Style
23-
import com.mapbox.maps.coroutine.cameraChangedEvents
24+
import com.mapbox.maps.coroutine.cameraChangedCoalescedEvents
2425
import com.mapbox.maps.coroutine.getFeatureState
2526
import com.mapbox.maps.coroutine.queryRenderedFeatures
2627
import com.mapbox.maps.coroutine.setFeatureState
@@ -95,11 +96,12 @@ class FeatureStateActivity : AppCompatActivity() {
9596
}
9697
}
9798

99+
@OptIn(MapboxExperimental::class)
98100
private suspend fun highlightFeatureOnHover() {
99101
val crosshairScreenBox = getCrosshairScreenBox()
100102

101103
// Observe camera changes and query the rendered features under the crosshair.
102-
mapboxMap.cameraChangedEvents
104+
mapboxMap.cameraChangedCoalescedEvents
103105
.map { _ ->
104106
mapboxMap
105107
.queryRenderedFeatures(

app/src/main/java/com/mapbox/maps/testapp/examples/markersandcallouts/viewannotation/DynamicViewAnnotationActivity.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import androidx.core.content.ContextCompat.getColor
1616
import androidx.core.content.ContextCompat.getDrawable
1717
import androidx.core.graphics.drawable.toDrawable
1818
import androidx.lifecycle.lifecycleScope
19+
import com.mapbox.annotation.MapboxExperimental
1920
import com.mapbox.geojson.Feature
2021
import com.mapbox.geojson.FeatureCollection
2122
import com.mapbox.geojson.GeometryCollection
@@ -284,10 +285,11 @@ class DynamicViewAnnotationActivity : AppCompatActivity() {
284285
/**
285286
* Renders the padding on top of the MapView.
286287
*/
288+
@OptIn(MapboxExperimental::class)
287289
private fun MapView.showPaddingZone() {
288290
val paddingView = PaddingView(context)
289291
addView(paddingView)
290-
mapboxMap.subscribeCameraChanged {
292+
mapboxMap.subscribeCameraChangedCoalesced {
291293
it.cameraState.padding.let { padding ->
292294
paddingView.updateRect(
293295
Rect(

0 commit comments

Comments
 (0)