Skip to content

Commit 2149e35

Browse files
committed
feat: Update dependencies and improve build configuration
Updated several dependencies to their latest versions and made improvements to the build process and codebase. (Note: using feat to force the release with the new maps-ktx version) Key changes: - **Dependency Updates**: - `compose-bom` to `2025.10.00` - `dokka` to `2.1.0` - `maps-ktx` to `5.2.1` - `mockk` to `1.14.6` - `org-jacoco-core` to `0.8.14` - **Build Configuration**: - Increased Gradle JVM arguments to `-Xmx4g` in `gradle.properties`. - Removed the redundant top-level `clean` task from the root `build.gradle.kts`. - **Code Refinements**: - Replaced `Bitmap.createBitmap` with the KTX equivalent `androidx.core.graphics.createBitmap` in `ClusterRenderer`. - Removed various unused imports across the codebase. - Improved comments in `Clustering.kt` by using fully qualified class names for better clarity.
1 parent 3c6ced2 commit 2149e35

7 files changed

Lines changed: 27 additions & 35 deletions

File tree

build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,3 @@ allprojects {
3737
version = "6.12.1"
3838
val projectArtifactId by extra { project.name }
3939
}
40-
41-
tasks.register("clean", Delete::class) {
42-
delete(rootProject.layout.buildDirectory)
43-
}

gradle.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
# any settings specified in this file.
55
# For more details on how to configure your build environment visit
66
# http://www.gradle.org/docs/current/userguide/build_environment.html
7-
# Specifies the JVM arguments used for the daemon process.
8-
# The setting is particularly useful for tweaking memory settings.
9-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
7+
# Gradle JVM arguments
8+
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
109
# When configured, Gradle will run in incubating parallel mode.
1110
# This option should only be used with decoupled projects. More details, visit
1211
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

gradle/libs.versions.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ agp = "8.13.0"
44
androidCore = "1.7.0"
55
androidx-core = "1.17.0"
66
androidxtest = "1.7.0"
7-
compose-bom = "2025.09.01"
8-
dokka = "2.0.0"
7+
compose-bom = "2025.10.00"
8+
dokka = "2.1.0"
99
espresso = "3.7.0"
1010
gradleMavenPublishPlugin = "0.34.0"
1111
jacoco-plugin = "0.2.1"
@@ -15,12 +15,12 @@ kotlin = "2.2.20"
1515
kotlinxCoroutines = "1.10.2"
1616
leakcanaryAndroid = "2.14"
1717
mapsecrets = "2.0.1"
18-
mapsktx = "5.2.0"
18+
mapsktx = "5.2.1"
1919
material3 = "1.4.0"
2020
materialIconsExtendedAndroid = "1.7.8"
21-
mockk = "1.14.5"
22-
mockkAndroid = "1.14.5"
23-
org-jacoco-core = "0.8.13"
21+
mockk = "1.14.6"
22+
mockkAndroid = "1.14.6"
23+
org-jacoco-core = "0.8.14"
2424
screenshot = "0.0.1-alpha11"
2525
constraintlayout = "2.2.1"
2626
material = "1.13.0"

maps-compose-utils/src/main/java/com/google/maps/android/compose/clustering/ClusterRenderer.kt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable
99
import androidx.compose.runtime.State
1010
import androidx.compose.ui.platform.AbstractComposeView
1111
import androidx.core.graphics.applyCanvas
12+
import androidx.core.graphics.createBitmap
1213
import androidx.core.view.doOnAttach
1314
import androidx.core.view.doOnDetach
1415
import com.google.android.gms.maps.GoogleMap
@@ -18,7 +19,6 @@ import com.google.android.gms.maps.model.MarkerOptions
1819
import com.google.maps.android.clustering.Cluster
1920
import com.google.maps.android.clustering.ClusterItem
2021
import com.google.maps.android.clustering.ClusterManager
21-
import com.google.maps.android.clustering.view.ClusterRenderer
2222
import com.google.maps.android.clustering.view.DefaultClusterRenderer
2323
import com.google.maps.android.compose.ComposeUiViewRenderer
2424
import kotlinx.coroutines.CoroutineScope
@@ -29,7 +29,7 @@ import kotlinx.coroutines.flow.collectLatest
2929
import kotlinx.coroutines.launch
3030

3131
/**
32-
* Implementation of [ClusterRenderer] that renders marker bitmaps from Compose UI content.
32+
* Implementation of [com.google.maps.android.clustering.view.ClusterRenderer] that renders marker bitmaps from Compose UI content.
3333
* [clusterContentState] renders clusters, and [clusterItemContentState] renders non-clustered
3434
* items.
3535
*/
@@ -54,15 +54,16 @@ internal class ComposeUiClusterRenderer<T : ClusterItem>(
5454
super.onClustersChanged(clusters)
5555
val keys = clusters.flatMap { it.computeViewKeys() }
5656

57-
with(keysToViews.iterator()) {
58-
forEach { (key, viewInfo) ->
59-
if (key !in keys) {
60-
remove()
61-
viewInfo.onRemove()
62-
}
57+
val iterator = keysToViews.iterator()
58+
while (iterator.hasNext()) {
59+
val (key, viewInfo) = iterator.next()
60+
if (key !in keys) {
61+
iterator.remove()
62+
viewInfo.onRemove()
6363
}
6464
}
65-
keys.forEach { key ->
65+
66+
for (key in keys) {
6667
if (key !in keysToViews.keys) {
6768
createAndAddView(key)
6869
}
@@ -173,14 +174,14 @@ internal class ComposeUiClusterRenderer<T : ClusterItem>(
173174
so trigger a draw to an empty canvas to force that */
174175
view.draw(fakeCanvas)
175176
val viewParent =
176-
view.parent as? ViewGroup ?: return Bitmap.createBitmap(20, 20, Bitmap.Config.ARGB_8888)
177+
view.parent as? ViewGroup ?: return createBitmap(20, 20, Bitmap.Config.ARGB_8888)
177178
.let(BitmapDescriptorFactory::fromBitmap)
178179
view.measure(
179180
View.MeasureSpec.makeMeasureSpec(viewParent.width, View.MeasureSpec.AT_MOST),
180181
View.MeasureSpec.makeMeasureSpec(viewParent.height, View.MeasureSpec.AT_MOST),
181182
)
182183
view.layout(0, 0, view.measuredWidth, view.measuredHeight)
183-
val bitmap = Bitmap.createBitmap(
184+
val bitmap = createBitmap(
184185
view.measuredWidth.takeIf { it > 0 } ?: 1,
185186
view.measuredHeight.takeIf { it > 0 } ?: 1,
186187
Bitmap.Config.ARGB_8888
@@ -227,4 +228,4 @@ internal class ComposeUiClusterRenderer<T : ClusterItem>(
227228
}
228229
}
229230

230-
}
231+
}

maps-compose-utils/src/main/java/com/google/maps/android/compose/clustering/Clustering.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ import androidx.compose.runtime.rememberUpdatedState
1313
import androidx.compose.runtime.snapshotFlow
1414
import androidx.compose.ui.UiComposable
1515
import androidx.compose.ui.platform.LocalContext
16-
import com.google.android.gms.maps.GoogleMap
1716
import com.google.maps.android.clustering.Cluster
1817
import com.google.maps.android.clustering.ClusterItem
1918
import com.google.maps.android.clustering.ClusterManager
2019
import com.google.maps.android.clustering.view.ClusterRenderer
2120
import com.google.maps.android.clustering.view.DefaultClusterRenderer
22-
import com.google.maps.android.collections.MarkerManager
2321
import com.google.maps.android.compose.GoogleMapComposable
2422
import com.google.maps.android.compose.InputHandler
2523
import com.google.maps.android.compose.MapEffect
@@ -355,12 +353,12 @@ private fun <T : ClusterItem> rememberClusterManager(
355353

356354
/**
357355
* This is a hack.
358-
* [ClusterManager] instantiates a [MarkerManager], which posts a runnable to the UI thread that
359-
* overwrites a bunch of [GoogleMap]'s listeners. Many Maps composables rely on those listeners
356+
* [ClusterManager] instantiates a [com.google.maps.android.collections.MarkerManager], which posts a runnable to the UI thread that
357+
* overwrites a bunch of [com.google.android.gms.maps.GoogleMap]'s listeners. Many Maps composables rely on those listeners
360358
* being set by [com.google.maps.android.compose.MapApplier].
361359
* This posts _another_ runnable which effectively undoes that, signaling MapApplier to set the
362360
* listeners again.
363-
* This is heavily coupled to implementation details of [MarkerManager].
361+
* This is heavily coupled to implementation details of [com.google.maps.android.collections.MarkerManager].
364362
*/
365363
@Composable
366364
private fun ResetMapListeners(
@@ -372,4 +370,4 @@ private fun ResetMapListeners(
372370
reattach()
373371
}
374372
}
375-
}
373+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import com.google.android.gms.maps.model.LatLng
3333
import kotlinx.coroutines.CancellableContinuation
3434
import kotlinx.coroutines.CancellationException
3535
import kotlinx.coroutines.Job
36-
import kotlinx.coroutines.cancel
3736
import kotlinx.coroutines.currentCoroutineContext
3837
import kotlinx.coroutines.suspendCancellableCoroutine
3938
import java.lang.Integer.MAX_VALUE
@@ -353,4 +352,4 @@ internal val LocalCameraPositionState = staticCompositionLocalOf { CameraPositio
353352
/** The current [CameraPositionState] used by the map. */
354353
public val currentCameraPositionState: CameraPositionState
355354
@[GoogleMapComposable ReadOnlyComposable Composable]
356-
get() = LocalCameraPositionState.current
355+
get() = LocalCameraPositionState.current

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
package com.google.maps.android.compose.streetview
1616

17-
import android.content.ComponentCallbacks
1817
import android.content.ComponentCallbacks2
1918
import android.content.res.Configuration
2019
import android.os.Bundle
@@ -190,4 +189,4 @@ private fun StreetViewPanoramaView.componentCallbacks2(): ComponentCallbacks2 =
190189
override fun onTrimMemory(level: Int) {
191190
this@componentCallbacks2.onLowMemory()
192191
}
193-
}
192+
}

0 commit comments

Comments
 (0)