@@ -69,6 +69,7 @@ import kotlinx.coroutines.launch
69
69
* @param grid represents the display of a coordinate system [Grid] on the composable MapView
70
70
* @param backgroundGrid the default color and context grid behind the map surface
71
71
* @param wrapAroundMode the [WrapAroundMode] to specify whether continuous panning across the international date line is enabled
72
+ * @param attributionState specifies the attribution bar's visibility, text changed and layout changed events
72
73
* @param onViewpointChanged lambda invoked when the viewpoint of the composable MapView has changed
73
74
* @param onInteractingChanged lambda invoked when the user starts and ends interacting with the composable MapView
74
75
* @param onRotate lambda invoked when a user performs a rotation gesture on the composable MapView
@@ -90,11 +91,12 @@ public fun MapView(
90
91
arcGISMap : ArcGISMap ? = null,
91
92
graphicsOverlays : GraphicsOverlayCollection = rememberGraphicsOverlayCollection(),
92
93
locationDisplay : LocationDisplay = rememberLocationDisplay(),
93
- wrapAroundMode : WrapAroundMode = WrapAroundMode .EnabledWhenSupported ,
94
94
geometryEditor : GeometryEditor ? = null,
95
95
mapViewInteractionOptions : MapViewInteractionOptions = MapViewInteractionOptions (),
96
96
viewLabelProperties : ViewLabelProperties = ViewLabelProperties (),
97
97
selectionProperties : SelectionProperties = SelectionProperties (),
98
+ wrapAroundMode : WrapAroundMode = WrapAroundMode .EnabledWhenSupported ,
99
+ attributionState : AttributionState = AttributionState (),
98
100
grid : Grid ? = null,
99
101
backgroundGrid : BackgroundGrid = BackgroundGrid (),
100
102
onViewpointChanged : (() -> Unit )? = null,
@@ -142,6 +144,8 @@ public fun MapView(
142
144
}
143
145
}
144
146
147
+ AttributionStateHandler (mapView, attributionState)
148
+
145
149
MapViewEventHandler (
146
150
mapView,
147
151
onViewpointChanged,
@@ -161,6 +165,27 @@ public fun MapView(
161
165
GraphicsOverlaysUpdater (graphicsOverlays, mapView)
162
166
}
163
167
168
+ /* *
169
+ * Sets up the attribution bar's property and events.
170
+ */
171
+ @Composable
172
+ private fun AttributionStateHandler (mapView : MapView , attributionState : AttributionState ) {
173
+ LaunchedEffect (attributionState) {
174
+ // isAttributionBarVisible does not take effect if applied in the AndroidView update callback
175
+ mapView.isAttributionBarVisible = attributionState.isAttributionBarVisible
176
+ launch {
177
+ mapView.attributionText.collect {
178
+ attributionState.onAttributionTextChanged?.invoke(it)
179
+ }
180
+ }
181
+ launch {
182
+ mapView.onAttributionBarLayoutChanged.collect { attributionBarLayoutChangedEvent ->
183
+ attributionState.onAttributionBarLayoutChanged?.invoke(attributionBarLayoutChangedEvent)
184
+ }
185
+ }
186
+ }
187
+ }
188
+
164
189
/* *
165
190
* Sets up the callbacks for all the view-based [mapView] events.
166
191
*/
0 commit comments