-
Notifications
You must be signed in to change notification settings - Fork 177
feat: Allow for info window customization on advanced markers #862
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
Open
petereair
wants to merge
1
commit into
googlemaps:main
Choose a base branch
from
petereair:info-window-customization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -605,7 +605,7 @@ public fun MarkerInfoWindowContent( | |
| * @param onInfoWindowClose a lambda invoked when the marker's info window is closed | ||
| * @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked | ||
| * @param infoWindow optional composable lambda expression for customizing | ||
| * the entire info window. If this value is non-null, the value in infoContent] | ||
| * the entire info window. If this value is non-null, the value in [infoContent] | ||
| * will be ignored. | ||
| * @param infoContent optional composable lambda expression for customizing | ||
| * the info window's content. If this value is non-null, [infoWindow] must be null. | ||
|
|
@@ -723,7 +723,7 @@ private fun MarkerImpl( | |
| * @param onInfoWindowClick a lambda invoked when the marker's info window is clicked | ||
| * @param onInfoWindowClose a lambda invoked when the marker's info window is closed | ||
| * @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked | ||
| * @param icon sets the icon for the marker | ||
| * @param icon sets the icon for the marker | ||
| * @param pinConfig the PinConfig object that will be used for the advanced marker | ||
| * @param iconView the custom view to be used on the advanced marker | ||
| * @param collisionBehavior the expected collision behavior | ||
|
|
@@ -778,6 +778,170 @@ public fun AdvancedMarker( | |
| ) | ||
| } | ||
|
|
||
| /** | ||
| * A composable for an advanced marker on the map wherein its entire info window can be | ||
| * customized. If this customization is not required, use | ||
| * [com.google.maps.android.compose.AdvancedMarker]. | ||
| * | ||
| * @param state the [MarkerState] to be used to control or observe the marker | ||
| * state such as its position and info window | ||
| * @param contentDescription the content description for accessibility purposes | ||
| * @param alpha the alpha (opacity) of the marker | ||
| * @param anchor the anchor for the marker image | ||
| * @param draggable sets the draggability for the marker | ||
| * @param flat sets if the marker should be flat against the map | ||
| * @param infoWindowAnchor the anchor point of the info window on the marker image | ||
| * @param rotation the rotation of the marker in degrees clockwise about the marker's anchor point | ||
| * @param snippet the snippet for the marker | ||
| * @param tag optional tag to associate with the marker | ||
| * @param title the title for the marker | ||
| * @param visible the visibility of the marker | ||
| * @param zIndex the z-index of the marker | ||
| * @param onClick a lambda invoked when the marker is clicked | ||
| * @param onInfoWindowClick a lambda invoked when the marker's info window is clicked | ||
| * @param onInfoWindowClose a lambda invoked when the marker's info window is closed | ||
| * @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked | ||
| * @param icon sets the icon for the marker | ||
| * @param pinConfig the PinConfig object that will be used for the advanced marker | ||
| * @param iconView the custom view to be used on the advanced marker | ||
| * @param collisionBehavior the expected collision behavior | ||
| * @param infoWindowContent optional composable lambda expression for customizing the | ||
| * info window's content | ||
| */ | ||
| @Composable | ||
| @GoogleMapComposable | ||
| public fun AdvancedMarkerInfoWindow( | ||
| state: MarkerState = rememberUpdatedMarkerState(), | ||
| contentDescription: String? = "", | ||
| alpha: Float = 1.0f, | ||
| anchor: Offset = Offset(0.5f, 1.0f), | ||
| draggable: Boolean = false, | ||
| flat: Boolean = false, | ||
| infoWindowAnchor: Offset = Offset(0.5f, 0.0f), | ||
| rotation: Float = 0.0f, | ||
| snippet: String? = null, | ||
| tag: Any? = null, | ||
| title: String? = null, | ||
| visible: Boolean = true, | ||
| zIndex: Float = 0.0f, | ||
| onClick: (Marker) -> Boolean = { false }, | ||
| onInfoWindowClick: (Marker) -> Unit = {}, | ||
| onInfoWindowClose: (Marker) -> Unit = {}, | ||
| onInfoWindowLongClick: (Marker) -> Unit = {}, | ||
| icon: BitmapDescriptor? = null, | ||
| pinConfig: PinConfig? = null, | ||
| iconView: View? = null, | ||
| collisionBehavior: Int = AdvancedMarkerOptions.CollisionBehavior.REQUIRED, | ||
| infoWindowContent: (@UiComposable @Composable (Marker) -> Unit)? = null | ||
| ) { | ||
| AdvancedMarkerImpl( | ||
| state = state, | ||
| contentDescription = contentDescription, | ||
| alpha = alpha, | ||
| anchor = anchor, | ||
| draggable = draggable, | ||
| flat = flat, | ||
| infoWindowAnchor = infoWindowAnchor, | ||
| rotation = rotation, | ||
| snippet = snippet, | ||
| tag = tag, | ||
| title = title, | ||
| visible = visible, | ||
| zIndex = zIndex, | ||
| onClick = onClick, | ||
| onInfoWindowClick = onInfoWindowClick, | ||
| onInfoWindowClose = onInfoWindowClose, | ||
| onInfoWindowLongClick = onInfoWindowLongClick, | ||
| icon = icon, | ||
| pinConfig = pinConfig, | ||
| iconView = iconView, | ||
| collisionBehavior = collisionBehavior, | ||
| infoWindow = infoWindowContent, | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * A composable for an advanced marker on the map wherein its info window contents can be | ||
| * customized. If this customization is not required, use | ||
| * [com.google.maps.android.compose.AdvancedMarker]. | ||
| * | ||
| * @param state the [MarkerState] to be used to control or observe the marker | ||
| * state such as its position and info window | ||
| * @param contentDescription the content description for accessibility purposes | ||
| * @param alpha the alpha (opacity) of the marker | ||
| * @param anchor the anchor for the marker image | ||
| * @param draggable sets the draggability for the marker | ||
| * @param flat sets if the marker should be flat against the map | ||
| * @param infoWindowAnchor the anchor point of the info window on the marker image | ||
| * @param rotation the rotation of the marker in degrees clockwise about the marker's anchor point | ||
| * @param snippet the snippet for the marker | ||
| * @param tag optional tag to associate with the marker | ||
| * @param title the title for the marker | ||
| * @param visible the visibility of the marker | ||
| * @param zIndex the z-index of the marker | ||
| * @param onClick a lambda invoked when the marker is clicked | ||
| * @param onInfoWindowClick a lambda invoked when the marker's info window is clicked | ||
| * @param onInfoWindowClose a lambda invoked when the marker's info window is closed | ||
| * @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked | ||
| * @param icon sets the icon for the marker | ||
| * @param pinConfig the PinConfig object that will be used for the advanced marker | ||
| * @param iconView the custom view to be used on the advanced marker | ||
| * @param collisionBehavior the expected collision behavior | ||
| * @param infoWindowContent optional composable lambda expression for customizing the | ||
|
Collaborator
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. Update documentation here too. |
||
| * info window's content | ||
| */ | ||
| @Composable | ||
| @GoogleMapComposable | ||
| public fun AdvancedMarkerInfoWindowContent( | ||
| state: MarkerState = rememberUpdatedMarkerState(), | ||
| contentDescription: String? = "", | ||
| alpha: Float = 1.0f, | ||
| anchor: Offset = Offset(0.5f, 1.0f), | ||
| draggable: Boolean = false, | ||
| flat: Boolean = false, | ||
| infoWindowAnchor: Offset = Offset(0.5f, 0.0f), | ||
| rotation: Float = 0.0f, | ||
| snippet: String? = null, | ||
| tag: Any? = null, | ||
| title: String? = null, | ||
| visible: Boolean = true, | ||
| zIndex: Float = 0.0f, | ||
| onClick: (Marker) -> Boolean = { false }, | ||
| onInfoWindowClick: (Marker) -> Unit = {}, | ||
| onInfoWindowClose: (Marker) -> Unit = {}, | ||
| onInfoWindowLongClick: (Marker) -> Unit = {}, | ||
| icon: BitmapDescriptor? = null, | ||
| pinConfig: PinConfig? = null, | ||
| iconView: View? = null, | ||
| collisionBehavior: Int = AdvancedMarkerOptions.CollisionBehavior.REQUIRED, | ||
| infoWindowContent: (@UiComposable @Composable (Marker) -> Unit)? = null, | ||
| ) { | ||
| AdvancedMarkerImpl( | ||
| state = state, | ||
| contentDescription = contentDescription, | ||
| alpha = alpha, | ||
| anchor = anchor, | ||
| draggable = draggable, | ||
| flat = flat, | ||
| infoWindowAnchor = infoWindowAnchor, | ||
| rotation = rotation, | ||
| snippet = snippet, | ||
| tag = tag, | ||
| title = title, | ||
| visible = visible, | ||
| zIndex = zIndex, | ||
| onClick = onClick, | ||
| onInfoWindowClick = onInfoWindowClick, | ||
| onInfoWindowClose = onInfoWindowClose, | ||
| onInfoWindowLongClick = onInfoWindowLongClick, | ||
| icon = icon, | ||
| pinConfig = pinConfig, | ||
| iconView = iconView, | ||
| collisionBehavior = collisionBehavior, | ||
| infoContent = infoWindowContent, | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * Internal implementation for an advanced marker on a Google map. | ||
| * | ||
|
|
@@ -800,7 +964,7 @@ public fun AdvancedMarker( | |
| * @param onInfoWindowClose a lambda invoked when the marker's info window is closed | ||
| * @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked | ||
| * @param infoWindow optional composable lambda expression for customizing | ||
| * the entire info window. If this value is non-null, the value in infoContent] | ||
| * the entire info window. If this value is non-null, the value in [infoContent] | ||
| * will be ignored. | ||
| * @param infoContent optional composable lambda expression for customizing | ||
| * the info window's content. If this value is non-null, [infoWindow] must be null. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
AdvancedMarkerInfoWindowmaps its trailing lambda to theinfoWindowparameter ofAdvancedMarkerImpl(which replaces the entire info window, including the frame/background), the KDoc should be updated to reflect that:(this is also how it is documented in
MarkerInfoWindowandAdvancedMarkerImpl)