Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies {
// the maven declaration of Maps Compose can be used as a snippet.
// implementation project(':maps-compose')
// [END_EXCLUDE]
implementation "com.google.maps.android:maps-compose:2.1.1"
implementation "com.google.maps.android:maps-compose:2.2.0"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like 2.2.0 isn't published yet. FYI @barbeau @wangela

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation 'com.google.android.gms:play-services-maps:18.0.2'
}
// [END maps_android_compose_dependency]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ internal class CircleNode(
* @param onClick a lambda invoked when the circle is clicked
*/
@Composable
@GoogleMapComposable
public fun Circle(
center: LatLng,
clickable: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public fun GoogleMap(
onMyLocationClick: (Location) -> Unit = {},
onPOIClick: (PointOfInterest) -> Unit = {},
contentPadding: PaddingValues = NoPadding,
content: (@Composable () -> Unit)? = null,
content: (@Composable @GoogleMapComposable () -> Unit)? = null,
) {
val context = LocalContext.current
val mapView = remember { MapView(context, googleMapOptionsFactory()) }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.google.maps.android.compose

import androidx.compose.runtime.ComposableTargetMarker

/**
* An annotation that can be used to mark a composable function as being expected to be use in a
* composable function that is also marked or inferred to be marked as a [GoogleMapComposable].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest adding in the Javadoc the result of using the annotation, which you have in the PR comment. Something like:

This will produce build warnings when Maps Compose composable functions are used outside of the GoogleMap content lambda. Similarly, a warning is shown when non-Maps Compose composables are used within the GoogleMap content lambda.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2f27a84

*
* This will produce build warnings when [GoogleMapComposable] composable functions are used outside
* of a [GoogleMapComposable] content lambda, and vice versa.
*/
@Retention(AnnotationRetention.BINARY)
@ComposableTargetMarker(description = "Google Map Composable")
@Target(
AnnotationTarget.FILE,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.TYPE,
AnnotationTarget.TYPE_PARAMETER,
)
public annotation class GoogleMapComposable
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class GroundOverlayPosition private constructor(
* @param onClick a lambda invoked when the ground overlay is clicked
*/
@Composable
@GoogleMapComposable
public fun GroundOverlay(
position: GroundOverlayPosition,
image: BitmapDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public fun rememberMarkerState(
* @param onInfoWindowLongClick a lambda invoked when the marker's info window is long clicked
*/
@Composable
@GoogleMapComposable
public fun Marker(
state: MarkerState = rememberMarkerState(),
alpha: Float = 1.0f,
Expand Down Expand Up @@ -213,6 +214,7 @@ public fun Marker(
* info window's content
*/
@Composable
@GoogleMapComposable
public fun MarkerInfoWindow(
state: MarkerState = rememberMarkerState(),
alpha: Float = 1.0f,
Expand Down Expand Up @@ -282,6 +284,7 @@ public fun MarkerInfoWindow(
* info window's content
*/
@Composable
@GoogleMapComposable
public fun MarkerInfoWindowContent(
state: MarkerState = rememberMarkerState(),
alpha: Float = 1.0f,
Expand Down Expand Up @@ -352,6 +355,7 @@ public fun MarkerInfoWindowContent(
* the info window's content. If this value is non-null, [infoWindow] must be null.
*/
@Composable
@GoogleMapComposable
private fun MarkerImpl(
state: MarkerState = rememberMarkerState(),
alpha: Float = 1.0f,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ internal class PolygonNode(
* @param onClick a lambda invoked when the polygon is clicked
*/
@Composable
@GoogleMapComposable
public fun Polygon(
points: List<LatLng>,
clickable: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ internal class PolylineNode(
* @param onClick a lambda invoked when the polyline is clicked
*/
@Composable
@GoogleMapComposable
public fun Polyline(
points: List<LatLng>,
clickable: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private class TileOverlayNode(
* @param onClick a lambda invoked when the tile overlay is clicked
*/
@Composable
@GoogleMapComposable
public fun TileOverlay(
tileProvider: TileProvider,
fadeIn: Boolean = true,
Expand Down