Skip to content

Commit

Permalink
feat: Add groundOverlayClicks()
Browse files Browse the repository at this point in the history
  • Loading branch information
arriolac committed Apr 7, 2021
1 parent ce77946 commit e932e53
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions maps-ktx/src/main/java/com/google/maps/android/ktx/GoogleMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,22 @@ public fun GoogleMap.cameraMoveStartedEvents(): Flow<Unit> =
}
}

/**
* Returns a flow that emits when a ground overlay is clicked. Using this to observe ground overlay
* clicks events will override an existing listener (if any) to
* [GoogleMap.setOnGroundOverlayClickListener].
*/
@ExperimentalCoroutinesApi
public fun GoogleMap.groundOverlayClicks(): Flow<GroundOverlay> =
callbackFlow {
setOnGroundOverlayClickListener {
offerCatching(it)
}
awaitClose {
setOnGroundOverlayClickListener(null)
}
}

/**
* Builds a new [GoogleMapOptions] using the provided [optionsActions].
*
Expand Down

0 comments on commit e932e53

Please sign in to comment.