-
Notifications
You must be signed in to change notification settings - Fork 6
SceneView: attribution #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d62a3dc
9d8826d
7d4bae4
8b6d13f
ded4f24
ccaa40b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,12 @@ | |
|
||
package com.arcgismaps.toolkit.geocompose | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.Stable | ||
import com.arcgismaps.mapping.view.AttributionBarLayoutChangeEvent | ||
import com.arcgismaps.mapping.view.GeoView | ||
import kotlinx.coroutines.launch | ||
|
||
/** | ||
* State holder for attribution bar related properties/events on the [com.arcgismaps.toolkit.geocompose.MapView]. | ||
|
@@ -32,3 +36,28 @@ public data class AttributionState( | |
val onAttributionBarLayoutChanged: ((AttributionBarLayoutChangeEvent) -> Unit)? = null | ||
) | ||
|
||
/** | ||
* Sets up the attribution bar's property and events. | ||
* | ||
* @since 200.4.0 | ||
*/ | ||
@Composable | ||
internal fun AttributionStateHandler(geoView: GeoView, attributionState: AttributionState) { | ||
LaunchedEffect(attributionState) { | ||
// isAttributionBarVisible does not take effect if applied in the AndroidView update callback | ||
geoView.isAttributionBarVisible = attributionState.isAttributionBarVisible | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this line be outside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It probably could be outside of the LaunchedEffect, but I don't think it matters in this case. The LaunchedEffect will be recomposed with every change of |
||
launch { | ||
geoView.attributionText.collect { | ||
attributionState.onAttributionTextChanged?.invoke(it) | ||
} | ||
} | ||
launch { | ||
geoView.onAttributionBarLayoutChanged.collect { attributionBarLayoutChangedEvent -> | ||
attributionState.onAttributionBarLayoutChanged?.invoke( | ||
attributionBarLayoutChangedEvent | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing
since
tagThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated