Skip to content

Commit 0c7d1ec

Browse files
petereairkikoso
authored andcommitted
Advanced marker info window support
(cherry picked from commit 1bb27ca)
1 parent ca66e98 commit 0c7d1ec

File tree

1 file changed

+167
-3
lines changed
  • maps-compose/src/main/java/com/google/maps/android/compose

1 file changed

+167
-3
lines changed

maps-compose/src/main/java/com/google/maps/android/compose/Marker.kt

Lines changed: 167 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ public fun MarkerInfoWindowContent(
605605
* @param onInfoWindowClose a lambda invoked when the marker's info window is closed
606606
* @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked
607607
* @param infoWindow optional composable lambda expression for customizing
608-
* the entire info window. If this value is non-null, the value in infoContent]
608+
* the entire info window. If this value is non-null, the value in [infoContent]
609609
* will be ignored.
610610
* @param infoContent optional composable lambda expression for customizing
611611
* the info window's content. If this value is non-null, [infoWindow] must be null.
@@ -723,7 +723,7 @@ private fun MarkerImpl(
723723
* @param onInfoWindowClick a lambda invoked when the marker's info window is clicked
724724
* @param onInfoWindowClose a lambda invoked when the marker's info window is closed
725725
* @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked
726-
* @param icon sets the icon for the marker
726+
* @param icon sets the icon for the marker
727727
* @param pinConfig the PinConfig object that will be used for the advanced marker
728728
* @param iconView the custom view to be used on the advanced marker
729729
* @param collisionBehavior the expected collision behavior
@@ -778,6 +778,170 @@ public fun AdvancedMarker(
778778
)
779779
}
780780

781+
/**
782+
* A composable for an advanced marker on the map wherein its entire info window can be
783+
* customized. If this customization is not required, use
784+
* [com.google.maps.android.compose.AdvancedMarker].
785+
*
786+
* @param state the [MarkerState] to be used to control or observe the marker
787+
* state such as its position and info window
788+
* @param contentDescription the content description for accessibility purposes
789+
* @param alpha the alpha (opacity) of the marker
790+
* @param anchor the anchor for the marker image
791+
* @param draggable sets the draggability for the marker
792+
* @param flat sets if the marker should be flat against the map
793+
* @param infoWindowAnchor the anchor point of the info window on the marker image
794+
* @param rotation the rotation of the marker in degrees clockwise about the marker's anchor point
795+
* @param snippet the snippet for the marker
796+
* @param tag optional tag to associate with the marker
797+
* @param title the title for the marker
798+
* @param visible the visibility of the marker
799+
* @param zIndex the z-index of the marker
800+
* @param onClick a lambda invoked when the marker is clicked
801+
* @param onInfoWindowClick a lambda invoked when the marker's info window is clicked
802+
* @param onInfoWindowClose a lambda invoked when the marker's info window is closed
803+
* @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked
804+
* @param icon sets the icon for the marker
805+
* @param pinConfig the PinConfig object that will be used for the advanced marker
806+
* @param iconView the custom view to be used on the advanced marker
807+
* @param collisionBehavior the expected collision behavior
808+
* @param infoWindowContent optional composable lambda expression for customizing the
809+
* info window's content
810+
*/
811+
@Composable
812+
@GoogleMapComposable
813+
public fun AdvancedMarkerInfoWindow(
814+
state: MarkerState = rememberUpdatedMarkerState(),
815+
contentDescription: String? = "",
816+
alpha: Float = 1.0f,
817+
anchor: Offset = Offset(0.5f, 1.0f),
818+
draggable: Boolean = false,
819+
flat: Boolean = false,
820+
infoWindowAnchor: Offset = Offset(0.5f, 0.0f),
821+
rotation: Float = 0.0f,
822+
snippet: String? = null,
823+
tag: Any? = null,
824+
title: String? = null,
825+
visible: Boolean = true,
826+
zIndex: Float = 0.0f,
827+
onClick: (Marker) -> Boolean = { false },
828+
onInfoWindowClick: (Marker) -> Unit = {},
829+
onInfoWindowClose: (Marker) -> Unit = {},
830+
onInfoWindowLongClick: (Marker) -> Unit = {},
831+
icon: BitmapDescriptor? = null,
832+
pinConfig: PinConfig? = null,
833+
iconView: View? = null,
834+
collisionBehavior: Int = AdvancedMarkerOptions.CollisionBehavior.REQUIRED,
835+
infoWindowContent: (@UiComposable @Composable (Marker) -> Unit)? = null
836+
) {
837+
AdvancedMarkerImpl(
838+
state = state,
839+
contentDescription = contentDescription,
840+
alpha = alpha,
841+
anchor = anchor,
842+
draggable = draggable,
843+
flat = flat,
844+
infoWindowAnchor = infoWindowAnchor,
845+
rotation = rotation,
846+
snippet = snippet,
847+
tag = tag,
848+
title = title,
849+
visible = visible,
850+
zIndex = zIndex,
851+
onClick = onClick,
852+
onInfoWindowClick = onInfoWindowClick,
853+
onInfoWindowClose = onInfoWindowClose,
854+
onInfoWindowLongClick = onInfoWindowLongClick,
855+
icon = icon,
856+
pinConfig = pinConfig,
857+
iconView = iconView,
858+
collisionBehavior = collisionBehavior,
859+
infoWindow = infoWindowContent,
860+
)
861+
}
862+
863+
/**
864+
* A composable for an advanced marker on the map wherein its info window contents can be
865+
* customized. If this customization is not required, use
866+
* [com.google.maps.android.compose.AdvancedMarker].
867+
*
868+
* @param state the [MarkerState] to be used to control or observe the marker
869+
* state such as its position and info window
870+
* @param contentDescription the content description for accessibility purposes
871+
* @param alpha the alpha (opacity) of the marker
872+
* @param anchor the anchor for the marker image
873+
* @param draggable sets the draggability for the marker
874+
* @param flat sets if the marker should be flat against the map
875+
* @param infoWindowAnchor the anchor point of the info window on the marker image
876+
* @param rotation the rotation of the marker in degrees clockwise about the marker's anchor point
877+
* @param snippet the snippet for the marker
878+
* @param tag optional tag to associate with the marker
879+
* @param title the title for the marker
880+
* @param visible the visibility of the marker
881+
* @param zIndex the z-index of the marker
882+
* @param onClick a lambda invoked when the marker is clicked
883+
* @param onInfoWindowClick a lambda invoked when the marker's info window is clicked
884+
* @param onInfoWindowClose a lambda invoked when the marker's info window is closed
885+
* @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked
886+
* @param icon sets the icon for the marker
887+
* @param pinConfig the PinConfig object that will be used for the advanced marker
888+
* @param iconView the custom view to be used on the advanced marker
889+
* @param collisionBehavior the expected collision behavior
890+
* @param infoWindowContent optional composable lambda expression for customizing the
891+
* info window's content
892+
*/
893+
@Composable
894+
@GoogleMapComposable
895+
public fun AdvancedMarkerInfoWindowContent(
896+
state: MarkerState = rememberUpdatedMarkerState(),
897+
contentDescription: String? = "",
898+
alpha: Float = 1.0f,
899+
anchor: Offset = Offset(0.5f, 1.0f),
900+
draggable: Boolean = false,
901+
flat: Boolean = false,
902+
infoWindowAnchor: Offset = Offset(0.5f, 0.0f),
903+
rotation: Float = 0.0f,
904+
snippet: String? = null,
905+
tag: Any? = null,
906+
title: String? = null,
907+
visible: Boolean = true,
908+
zIndex: Float = 0.0f,
909+
onClick: (Marker) -> Boolean = { false },
910+
onInfoWindowClick: (Marker) -> Unit = {},
911+
onInfoWindowClose: (Marker) -> Unit = {},
912+
onInfoWindowLongClick: (Marker) -> Unit = {},
913+
icon: BitmapDescriptor? = null,
914+
pinConfig: PinConfig? = null,
915+
iconView: View? = null,
916+
collisionBehavior: Int = AdvancedMarkerOptions.CollisionBehavior.REQUIRED,
917+
infoWindowContent: (@UiComposable @Composable (Marker) -> Unit)? = null,
918+
) {
919+
AdvancedMarkerImpl(
920+
state = state,
921+
contentDescription = contentDescription,
922+
alpha = alpha,
923+
anchor = anchor,
924+
draggable = draggable,
925+
flat = flat,
926+
infoWindowAnchor = infoWindowAnchor,
927+
rotation = rotation,
928+
snippet = snippet,
929+
tag = tag,
930+
title = title,
931+
visible = visible,
932+
zIndex = zIndex,
933+
onClick = onClick,
934+
onInfoWindowClick = onInfoWindowClick,
935+
onInfoWindowClose = onInfoWindowClose,
936+
onInfoWindowLongClick = onInfoWindowLongClick,
937+
icon = icon,
938+
pinConfig = pinConfig,
939+
iconView = iconView,
940+
collisionBehavior = collisionBehavior,
941+
infoContent = infoWindowContent,
942+
)
943+
}
944+
781945
/**
782946
* Internal implementation for an advanced marker on a Google map.
783947
*
@@ -800,7 +964,7 @@ public fun AdvancedMarker(
800964
* @param onInfoWindowClose a lambda invoked when the marker's info window is closed
801965
* @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked
802966
* @param infoWindow optional composable lambda expression for customizing
803-
* the entire info window. If this value is non-null, the value in infoContent]
967+
* the entire info window. If this value is non-null, the value in [infoContent]
804968
* will be ignored.
805969
* @param infoContent optional composable lambda expression for customizing
806970
* the info window's content. If this value is non-null, [infoWindow] must be null.

0 commit comments

Comments
 (0)