-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat!: migrate android-maps-ktx into android-maps-utils (v6.0.0) #1716
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
base: main
Are you sure you want to change the base?
Changes from all commits
37bf78b
0757124
271ba72
1b3e174
295bfd4
507c7df
4681134
c389f40
847a719
258d111
17beee0
e2728db
85cb2fb
7077a63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
|
|
||
| package com.google.maps.android.clustering | ||
|
|
||
| import com.google.maps.android.clustering.Cluster | ||
| import com.google.maps.android.clustering.ClusterItem | ||
| import com.google.maps.android.clustering.ClusterManager | ||
| import kotlinx.coroutines.channels.awaitClose | ||
| import kotlinx.coroutines.flow.Flow | ||
| import kotlinx.coroutines.flow.callbackFlow | ||
|
|
||
| /** | ||
| * Returns a flow that emits when a cluster is clicked. Using this to observe cluster clicks | ||
| * will override an existing listener (if any) to [ClusterManager.setOnClusterClickListener]. | ||
| * | ||
| * **Warning**: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing | ||
| * multiple collectors will result in listener hijacking, and cancelling any observer will unregister | ||
| * the active listener completely. Always share this flow (e.g. using [kotlinx.coroutines.flow.shareIn]) | ||
| * for multi-observer configurations. | ||
| * | ||
| * **Note on event consumption**: The underlying SDK listener returns the result of `trySend().isSuccess`. | ||
| * When an emission is accepted by the flow buffer, the click event is considered consumed (`true`), | ||
| * suppressing default SDK behavior (such as zooming). Under backpressure if the buffer is full, | ||
| * `trySend` returns `false`, allowing default SDK click handling to proceed. | ||
| */ | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterClickEvents(): Flow<Cluster<T>> = | ||
|
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. These six functions are public and return So the published POM for Can you move it to
Contributor
Author
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. Fixed in |
||
| callbackFlow { | ||
| setOnClusterClickListener { | ||
| trySend(it).isSuccess | ||
|
dkhawk marked this conversation as resolved.
|
||
| } | ||
| awaitClose { | ||
| setOnClusterClickListener(null) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns a flow that emits when a cluster item is clicked. Using this to observe cluster item clicks | ||
| * will override an existing listener (if any) to [ClusterManager.setOnClusterItemClickListener]. | ||
| * | ||
| * **Warning**: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing | ||
| * multiple collectors will result in listener hijacking, and cancelling any observer will unregister | ||
| * the active listener completely. Always share this flow (e.g. using [kotlinx.coroutines.flow.shareIn]) | ||
| * for multi-observer configurations. | ||
| * | ||
| * **Note on event consumption**: The underlying SDK listener returns the result of `trySend().isSuccess`. | ||
| * When an emission is accepted by the flow buffer, the click event is considered consumed (`true`), | ||
| * suppressing default SDK behavior. Under backpressure if the buffer is full, `trySend` returns `false`, | ||
| * allowing default SDK click handling to proceed. | ||
| */ | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterItemClickEvents(): Flow<T> = | ||
| callbackFlow { | ||
| setOnClusterItemClickListener { | ||
| trySend(it).isSuccess | ||
| } | ||
| awaitClose { | ||
| setOnClusterItemClickListener(null) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns a flow that emits when a cluster's info window is clicked. Using this to observe cluster info window clicks | ||
| * will override an existing listener (if any) to [ClusterManager.setOnClusterInfoWindowClickListener]. | ||
| * | ||
| * **Warning**: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing | ||
| * multiple collectors will result in listener hijacking, and cancelling any observer will unregister | ||
| * the active listener completely. Always share this flow (e.g. using [kotlinx.coroutines.flow.shareIn]) | ||
| * for multi-observer configurations. | ||
| */ | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterInfoWindowClickEvents(): Flow<Cluster<T>> = | ||
| callbackFlow { | ||
| setOnClusterInfoWindowClickListener { | ||
| trySend(it).isSuccess | ||
| } | ||
| awaitClose { | ||
| setOnClusterInfoWindowClickListener(null) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns a flow that emits when a cluster's info window is long clicked. Using this to observe cluster info window long clicks | ||
| * will override an existing listener (if any) to [ClusterManager.setOnClusterInfoWindowLongClickListener]. | ||
| * | ||
| * **Warning**: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing | ||
| * multiple collectors will result in listener hijacking, and cancelling any observer will unregister | ||
| * the active listener completely. Always share this flow (e.g. using [kotlinx.coroutines.flow.shareIn]) | ||
| * for multi-observer configurations. | ||
| */ | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterInfoWindowLongClickEvents(): Flow<Cluster<T>> = | ||
| callbackFlow { | ||
| setOnClusterInfoWindowLongClickListener { | ||
| trySend(it).isSuccess | ||
| } | ||
| awaitClose { | ||
| setOnClusterInfoWindowLongClickListener(null) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns a flow that emits when a cluster item's info window is clicked. Using this to observe cluster item info window clicks | ||
| * will override an existing listener (if any) to [ClusterManager.setOnClusterItemInfoWindowClickListener]. | ||
| * | ||
| * **Warning**: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing | ||
| * multiple collectors will result in listener hijacking, and cancelling any observer will unregister | ||
| * the active listener completely. Always share this flow (e.g. using [kotlinx.coroutines.flow.shareIn]) | ||
| * for multi-observer configurations. | ||
| */ | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterItemInfoWindowClickEvents(): Flow<T> = | ||
| callbackFlow { | ||
| setOnClusterItemInfoWindowClickListener { | ||
| trySend(it).isSuccess | ||
| } | ||
| awaitClose { | ||
| setOnClusterItemInfoWindowClickListener(null) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns a flow that emits when a cluster item's info window is long clicked. Using this to observe cluster item info window long clicks | ||
| * will override an existing listener (if any) to [ClusterManager.setOnClusterItemInfoWindowLongClickListener]. | ||
| * | ||
| * **Warning**: This is a cold flow wrapping a single-listener SDK callback. Concurrently subscribing | ||
| * multiple collectors will result in listener hijacking, and cancelling any observer will unregister | ||
| * the active listener completely. Always share this flow (e.g. using [kotlinx.coroutines.flow.shareIn]) | ||
| * for multi-observer configurations. | ||
| */ | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterItemInfoWindowLongClickEvents(): Flow<T> = | ||
| callbackFlow { | ||
| setOnClusterItemInfoWindowLongClickListener { | ||
| trySend(it).isSuccess | ||
| } | ||
| awaitClose { | ||
| setOnClusterItemInfoWindowLongClickListener(null) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
|
|
||
| package com.google.maps.android.geometry | ||
|
|
||
| import com.google.maps.android.geometry.Point | ||
|
|
||
| /** | ||
| * Returns the x value of this Point. | ||
| * | ||
| * e.g. | ||
| * | ||
| * ``` | ||
| * val (x, _) = point | ||
| * ``` | ||
| */ | ||
| public operator fun Point.component1(): Double = this.x | ||
|
|
||
| /** | ||
| * Returns the y value of this Point. | ||
| * | ||
| * e.g. | ||
| * | ||
| * ``` | ||
| * val (_, y) = point | ||
| */ | ||
| public operator fun Point.component2(): Double = this.y |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.google.maps.android.ktx.utils.clustering | ||
|
|
||
| import com.google.maps.android.clustering.Cluster | ||
| import com.google.maps.android.clustering.ClusterItem | ||
| import com.google.maps.android.clustering.ClusterManager | ||
| import kotlinx.coroutines.flow.Flow | ||
| import com.google.maps.android.clustering.clusterClickEvents as canonicalClusterClickEvents | ||
| import com.google.maps.android.clustering.clusterItemClickEvents as canonicalClusterItemClickEvents | ||
| import com.google.maps.android.clustering.clusterInfoWindowClickEvents as canonicalClusterInfoWindowClickEvents | ||
| import com.google.maps.android.clustering.clusterInfoWindowLongClickEvents as canonicalClusterInfoWindowLongClickEvents | ||
| import com.google.maps.android.clustering.clusterItemInfoWindowClickEvents as canonicalClusterItemInfoWindowClickEvents | ||
| import com.google.maps.android.clustering.clusterItemInfoWindowLongClickEvents as canonicalClusterItemInfoWindowLongClickEvents | ||
|
|
||
| @Deprecated("Moved to com.google.maps.android.clustering.clusterClickEvents", ReplaceWith("clusterClickEvents()", "com.google.maps.android.clustering.clusterClickEvents")) | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterClickEvents(): Flow<Cluster<T>> = this.canonicalClusterClickEvents() | ||
|
|
||
| @Deprecated("Moved to com.google.maps.android.clustering.clusterItemClickEvents", ReplaceWith("clusterItemClickEvents()", "com.google.maps.android.clustering.clusterItemClickEvents")) | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterItemClickEvents(): Flow<T> = this.canonicalClusterItemClickEvents() | ||
|
|
||
| @Deprecated("Moved to com.google.maps.android.clustering.clusterInfoWindowClickEvents", ReplaceWith("clusterInfoWindowClickEvents()", "com.google.maps.android.clustering.clusterInfoWindowClickEvents")) | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterInfoWindowClickEvents(): Flow<Cluster<T>> = this.canonicalClusterInfoWindowClickEvents() | ||
|
|
||
| @Deprecated("Moved to com.google.maps.android.clustering.clusterInfoWindowLongClickEvents", ReplaceWith("clusterInfoWindowLongClickEvents()", "com.google.maps.android.clustering.clusterInfoWindowLongClickEvents")) | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterInfoWindowLongClickEvents(): Flow<Cluster<T>> = this.canonicalClusterInfoWindowLongClickEvents() | ||
|
|
||
| @Deprecated("Moved to com.google.maps.android.clustering.clusterItemInfoWindowClickEvents", ReplaceWith("clusterItemInfoWindowClickEvents()", "com.google.maps.android.clustering.clusterItemInfoWindowClickEvents")) | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterItemInfoWindowClickEvents(): Flow<T> = this.canonicalClusterItemInfoWindowClickEvents() | ||
|
|
||
| @Deprecated("Moved to com.google.maps.android.clustering.clusterItemInfoWindowLongClickEvents", ReplaceWith("clusterItemInfoWindowLongClickEvents()", "com.google.maps.android.clustering.clusterItemInfoWindowLongClickEvents")) | ||
| public fun <T : ClusterItem> ClusterManager<T>.clusterItemInfoWindowLongClickEvents(): Flow<T> = this.canonicalClusterItemInfoWindowLongClickEvents() |
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.
This one still says 5.2.0 while every other marker got bumped to rc04. Another reason to let release-please handle all of them rather than bumping by hand.
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.
Fixed in
85cb2fbf— revertedREADME.mdto matchorigin/mainsorelease-pleaseupdates all version markers together.