Skip to content

Commit

Permalink
feat: Add groundOverlayClicks() (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
arriolac committed Jun 4, 2021
1 parent 35c69b6 commit 83446e8
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 @@ -223,6 +223,22 @@ public fun GoogleMap.circleClickEvents(): Flow<Circle> =
}
}

/**
* 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 83446e8

Please sign in to comment.