Skip to content
Open
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
4 changes: 0 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,3 @@ allprojects {
version = "6.12.1"
val projectArtifactId by extra { project.name }
}

tasks.register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory)
}
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Gradle JVM arguments
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ agp = "8.13.0"
androidCore = "1.7.0"
androidx-core = "1.17.0"
androidxtest = "1.7.0"
compose-bom = "2025.09.01"
dokka = "2.0.0"
compose-bom = "2025.10.00"
dokka = "2.1.0"
espresso = "3.7.0"
gradleMavenPublishPlugin = "0.34.0"
jacoco-plugin = "0.2.1"
Expand All @@ -15,12 +15,12 @@ kotlin = "2.2.20"
kotlinxCoroutines = "1.10.2"
leakcanaryAndroid = "2.14"
mapsecrets = "2.0.1"
mapsktx = "5.2.0"
mapsktx = "5.2.1"
material3 = "1.4.0"
materialIconsExtendedAndroid = "1.7.8"
mockk = "1.14.5"
mockkAndroid = "1.14.5"
org-jacoco-core = "0.8.13"
mockk = "1.14.6"
mockkAndroid = "1.14.6"
org-jacoco-core = "0.8.14"
screenshot = "0.0.1-alpha11"
constraintlayout = "2.2.1"
material = "1.13.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.ui.platform.AbstractComposeView
import androidx.core.graphics.applyCanvas
import androidx.core.graphics.createBitmap
import androidx.core.view.doOnAttach
import androidx.core.view.doOnDetach
import com.google.android.gms.maps.GoogleMap
Expand All @@ -18,7 +19,6 @@ import com.google.android.gms.maps.model.MarkerOptions
import com.google.maps.android.clustering.Cluster
import com.google.maps.android.clustering.ClusterItem
import com.google.maps.android.clustering.ClusterManager
import com.google.maps.android.clustering.view.ClusterRenderer
import com.google.maps.android.clustering.view.DefaultClusterRenderer
import com.google.maps.android.compose.ComposeUiViewRenderer
import kotlinx.coroutines.CoroutineScope
Expand All @@ -29,7 +29,7 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch

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

with(keysToViews.iterator()) {
forEach { (key, viewInfo) ->
if (key !in keys) {
remove()
viewInfo.onRemove()
}
val iterator = keysToViews.iterator()
while (iterator.hasNext()) {
val (key, viewInfo) = iterator.next()
if (key !in keys) {
iterator.remove()
viewInfo.onRemove()
}
}
keys.forEach { key ->

for (key in keys) {
if (key !in keysToViews.keys) {
createAndAddView(key)
}
Expand Down Expand Up @@ -173,14 +174,14 @@ internal class ComposeUiClusterRenderer<T : ClusterItem>(
so trigger a draw to an empty canvas to force that */
view.draw(fakeCanvas)
val viewParent =
view.parent as? ViewGroup ?: return Bitmap.createBitmap(20, 20, Bitmap.Config.ARGB_8888)
view.parent as? ViewGroup ?: return createBitmap(20, 20, Bitmap.Config.ARGB_8888)
.let(BitmapDescriptorFactory::fromBitmap)
view.measure(
View.MeasureSpec.makeMeasureSpec(viewParent.width, View.MeasureSpec.AT_MOST),
View.MeasureSpec.makeMeasureSpec(viewParent.height, View.MeasureSpec.AT_MOST),
)
view.layout(0, 0, view.measuredWidth, view.measuredHeight)
val bitmap = Bitmap.createBitmap(
val bitmap = createBitmap(
view.measuredWidth.takeIf { it > 0 } ?: 1,
view.measuredHeight.takeIf { it > 0 } ?: 1,
Bitmap.Config.ARGB_8888
Expand Down Expand Up @@ -227,4 +228,4 @@ internal class ComposeUiClusterRenderer<T : ClusterItem>(
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.UiComposable
import androidx.compose.ui.platform.LocalContext
import com.google.android.gms.maps.GoogleMap
import com.google.maps.android.clustering.Cluster
import com.google.maps.android.clustering.ClusterItem
import com.google.maps.android.clustering.ClusterManager
import com.google.maps.android.clustering.view.ClusterRenderer
import com.google.maps.android.clustering.view.DefaultClusterRenderer
import com.google.maps.android.collections.MarkerManager
import com.google.maps.android.compose.GoogleMapComposable
import com.google.maps.android.compose.InputHandler
import com.google.maps.android.compose.MapEffect
Expand Down Expand Up @@ -355,12 +353,12 @@ private fun <T : ClusterItem> rememberClusterManager(

/**
* This is a hack.
* [ClusterManager] instantiates a [MarkerManager], which posts a runnable to the UI thread that
* overwrites a bunch of [GoogleMap]'s listeners. Many Maps composables rely on those listeners
* [ClusterManager] instantiates a [com.google.maps.android.collections.MarkerManager], which posts a runnable to the UI thread that
* overwrites a bunch of [com.google.android.gms.maps.GoogleMap]'s listeners. Many Maps composables rely on those listeners
* being set by [com.google.maps.android.compose.MapApplier].
* This posts _another_ runnable which effectively undoes that, signaling MapApplier to set the
* listeners again.
* This is heavily coupled to implementation details of [MarkerManager].
* This is heavily coupled to implementation details of [com.google.maps.android.collections.MarkerManager].
*/
@Composable
private fun ResetMapListeners(
Expand All @@ -372,4 +370,4 @@ private fun ResetMapListeners(
reattach()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.google.android.gms.maps.model.LatLng
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.suspendCancellableCoroutine
import java.lang.Integer.MAX_VALUE
Expand Down Expand Up @@ -353,4 +352,4 @@ internal val LocalCameraPositionState = staticCompositionLocalOf { CameraPositio
/** The current [CameraPositionState] used by the map. */
public val currentCameraPositionState: CameraPositionState
@[GoogleMapComposable ReadOnlyComposable Composable]
get() = LocalCameraPositionState.current
get() = LocalCameraPositionState.current
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

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

import android.content.ComponentCallbacks
import android.content.ComponentCallbacks2
import android.content.res.Configuration
import android.os.Bundle
Expand Down Expand Up @@ -190,4 +189,4 @@ private fun StreetViewPanoramaView.componentCallbacks2(): ComponentCallbacks2 =
override fun onTrimMemory(level: Int) {
this@componentCallbacks2.onLowMemory()
}
}
}
Loading