Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Maps3DSamples/ApiDemos/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ dependencies {

api(libs.play.services.base) // "com.google.android.gms:play-services-base:18.10.0"
api(libs.play.services.maps3d) // "com.google.android.gms:play-services-maps3d:0.2.2"
api(libs.maps.utils.ktx)
api(libs.android.maps.utils)
}

jacoco {
Expand Down
10 changes: 8 additions & 2 deletions Maps3DSamples/ComposeDemos/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ plugins {
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint().editorConfigOverride(mapOf("indent_size" to "4", "ktlint_function_naming_ignore_when_annotated_with" to "Composable"))
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "4",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_standard_max-line-length" to "disabled",
),
)
trimTrailingWhitespace()
endWithNewline()
}
Expand Down Expand Up @@ -101,7 +107,7 @@ dependencies {
implementation(libs.androidx.fragment.ktx)

// Maps Utils
implementation(libs.maps.utils.ktx)
implementation(libs.android.maps.utils)

// Material Icons Extended
implementation(libs.androidx.material.icons.extended)
Expand Down
2 changes: 1 addition & 1 deletion Maps3DSamples/advanced/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ dependencies {
testImplementation(libs.google.truth)

// Google Maps Utils for the polyline decoder
implementation(libs.maps.utils.ktx)
implementation(libs.android.maps.utils)

implementation(libs.ktor.client.core)
implementation(libs.ktor.client.cio)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package com.example.advancedmaps3dsamples.scenarios

import com.example.advancedmaps3dsamples.R
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.ktx.utils.latLngListEncode
import com.google.maps.android.latLngListEncode

const val PLANE_URL = "https://storage.googleapis.com/gmp-maps-demos/p3d-map/assets/Airplane.glb"
const val PLANE_SCALE = 0.05
Expand Down
11 changes: 6 additions & 5 deletions Maps3DSamples/advanced/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ agp = "9.2.1"
kotlin = "2.3.20"
kotlinxDatetime = "0.8.0"
kotlinxSerialization = "1.11.0"
ktor = "3.5.2"
coreKtx = "1.19.0"
ktor = "3.6.0"
coreKtx = "1.19.1"
junit = "4.13.2"
junitVersion = "1.3.0"
espressoCore = "3.7.0"
lifecycleRuntimeKtx = "2.11.0"
activityCompose = "1.13.0"
composeBom = "2026.06.01"
composeBom = "2026.09.00"

hilt = "2.60.1"
ksp = "2.3.6"
playServicesMaps3d = "0.2.2"
playServicesBase = "18.10.0"
secretsGradlePlugin = "2.0.1"
truth = "1.4.5"
mapsUtilsKtx = "6.3.0"
mapsUtils = "6.0.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand Down Expand Up @@ -51,7 +51,8 @@ ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
play-services-maps3d = { module = "com.google.android.gms:play-services-maps3d", version.ref = "playServicesMaps3d" }
maps-utils-ktx = { module = "com.google.maps.android:maps-utils-ktx", version.ref = "mapsUtilsKtx" }
android-maps-utils = { module = "com.google.maps.android:android-maps-utils", version.ref = "mapsUtils" }
android-maps-utils-core = { module = "com.google.maps.android:android-maps-utils-core", version.ref = "mapsUtils" }
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
play-services-base = { module = "com.google.android.gms:play-services-base", version.ref = "playServicesBase" }

Expand Down
2 changes: 1 addition & 1 deletion PlacesUIKit3D/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ dependencies {
implementation(libs.play.services.maps3d) // The core SDK for embedding 3D Google Maps.
implementation(libs.places) // The SDK for the Places UI Kit (PlaceDetails fragments).
implementation(libs.places.compose) // Official Places Compose autocomplete UI kit.
implementation(libs.maps.utils.ktx) // Google Maps Utils for polyline decoding and other utilities.
implementation(libs.android.maps.utils) // Google Maps Utils for polyline decoding and other utilities.

// --- Dependency Injection ---
// Hilt is used for managing dependencies and object lifecycles.
Expand Down
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@
* limitations under the License.
*/

import org.gradle.api.tasks.testing.Test
import java.util.Properties

plugins {
alias(libs.plugins.spotless) apply false
}

subprojects {
tasks.withType<Test>().configureEach {
jvmArgs("--add-opens=java.base/jdk.internal.access=ALL-UNNAMED")
}
}

// Evaluate if we are in a CI environment
val isCI = System.getenv("CI")?.toBoolean() ?: false

Expand Down
17 changes: 9 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ targetSdk = "36"

core = "1.7.0"
json = "20260522"
robolectric = "4.16.1"
robolectric = "4.17"

activityCompose = "1.13.0"
agp = "9.2.1"
appcompat = "1.7.1"
composeBom = "2026.06.01"
coreKtx = "1.19.0"
appcompat = "1.8.0"
composeBom = "2026.09.00"
coreKtx = "1.19.1"
desugar_jdk_libs = "2.1.5"
espressoCore = "3.7.0"
junit = "4.13.2"
Expand All @@ -23,18 +23,18 @@ material = "1.14.0"
playServicesBase = "18.10.0"
playServicesMaps3d = "0.2.2"
places = "5.3.0"
placesCompose = "0.2.1"
placesCompose = "0.3.0"
secretsGradlePlugin = "2.0.1"
truth = "1.4.5"
uiautomator = "2.4.0"
spotless = "8.9.0"

kotlinxDatetime = "0.8.0"
kotlinxSerialization = "1.11.0"
ktor = "3.5.2"
ktor = "3.6.0"
hilt = "2.60.1"
ksp = "2.3.6"
mapsUtilsKtx = "6.3.0"
mapsUtils = "6.0.0"
androidx-core-ktx = "1.8.9"
androidxArchCoreTesting = "2.2.0"
kotlinxCoroutines = "1.8.0"
Expand Down Expand Up @@ -83,7 +83,8 @@ ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
maps-utils-ktx = { module = "com.google.maps.android:maps-utils-ktx", version.ref = "mapsUtilsKtx" }
android-maps-utils = { module = "com.google.maps.android:android-maps-utils", version.ref = "mapsUtils" }
android-maps-utils-core = { module = "com.google.maps.android:android-maps-utils-core", version.ref = "mapsUtils" }
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }

[plugins]
Expand Down
8 changes: 7 additions & 1 deletion maps3d-compose-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ plugins {
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint().editorConfigOverride(mapOf("indent_size" to "4", "ktlint_function_naming_ignore_when_annotated_with" to "Composable"))
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "4",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_standard_max-line-length" to "disabled",
),
)
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
10 changes: 8 additions & 2 deletions maps3d-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ plugins {
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint().editorConfigOverride(mapOf("indent_size" to "4", "ktlint_function_naming_ignore_when_annotated_with" to "Composable"))
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "4",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_standard_max-line-length" to "disabled",
),
)
trimTrailingWhitespace()
endWithNewline()
}
Expand Down Expand Up @@ -66,7 +72,7 @@ dependencies {

// Maps 3D SDK
implementation(libs.play.services.maps3d)
implementation(libs.maps.utils.ktx)
implementation(libs.android.maps.utils)

testImplementation(libs.junit)
testImplementation(libs.robolectric)
Expand Down
8 changes: 7 additions & 1 deletion snippets/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ subprojects {
}
kotlin {
target("**/*.kt")
ktlint().editorConfigOverride(mapOf("indent_size" to "4", "ktlint_function_naming_ignore_when_annotated_with" to "Composable"))
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "4",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_standard_max-line-length" to "disabled",
),
)
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ class MapActivity : AppCompatActivity() {
val groupTitle = intent.getStringExtra("group_title")
val snippetTitle = intent.getStringExtra(EXTRA_SNIPPET_TITLE)
val snippetList = SnippetRegistry.getSnippetGroups().flatMap { it.items }
var currentIndex = snippetList.indexOfFirst { it.title == snippetTitle && (groupTitle == null || it.groupTitle == groupTitle) }
var currentIndex = snippetList.indexOfFirst {
it.title == snippetTitle &&
(groupTitle == null || it.groupTitle == groupTitle)
}

findViewById<MaterialButton>(R.id.snapshot_button).apply {
setOnClickListener {
Expand Down Expand Up @@ -187,7 +190,10 @@ class MapActivity : AppCompatActivity() {
if (snippetTitle == null) return
val key = if (groupTitle != null) "$groupTitle - $snippetTitle" else snippetTitle
val snippet = SnippetRegistry.snippets[key]
?: SnippetRegistry.getSnippetGroups().flatMap { it.items }.find { it.title == snippetTitle }
?: SnippetRegistry.getSnippetGroups().flatMap { it.items }.find {
it.title ==
snippetTitle
}
?: return
if (!::googleMap3D.isInitialized) return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ object SnippetRegistry {
// Most snippet methods take no args because they use initialized class fields
if (method.parameterCount == 0) {
method.invoke(instance)
} else if (method.parameterCount == 1 && method.parameterTypes[0] == Context::class.java) {
} else if (method.parameterCount == 1 &&
method.parameterTypes[0] == Context::class.java
) {
method.invoke(instance, context)
} else {
// Fallback or log error
Expand All @@ -132,14 +134,29 @@ object SnippetRegistry {
return groups
}

private fun createInstance(clazz: Class<*>, context: Context, map: TrackedMap3D, scope: CoroutineScope): Any = try {
clazz.getConstructor(Context::class.java, TrackedMap3D::class.java, CoroutineScope::class.java).newInstance(context, map, scope)
private fun createInstance(
clazz: Class<*>,
context: Context,
map: TrackedMap3D,
scope: CoroutineScope,
): Any = try {
clazz.getConstructor(
Context::class.java,
TrackedMap3D::class.java,
CoroutineScope::class.java,
).newInstance(context, map, scope)
} catch (e: Exception) {
try {
clazz.getConstructor(TrackedMap3D::class.java, CoroutineScope::class.java).newInstance(map, scope)
clazz.getConstructor(
TrackedMap3D::class.java,
CoroutineScope::class.java,
).newInstance(map, scope)
} catch (e: Exception) {
try {
clazz.getConstructor(Context::class.java, TrackedMap3D::class.java).newInstance(context, map)
clazz.getConstructor(
Context::class.java,
TrackedMap3D::class.java,
).newInstance(context, map)
} catch (e: Exception) {
try {
clazz.getConstructor(TrackedMap3D::class.java).newInstance(map)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ import com.google.android.gms.maps3d.model.PopoverOptions
/**
* Decorator wrapper around GoogleMap3D to track elements added during a snippet session.
*/
class TrackedMap3D(
val delegate: GoogleMap3D,
private val items: MutableList<Any>,
) {
class TrackedMap3D(val delegate: GoogleMap3D, private val items: MutableList<Any>) {

fun addMarker(options: MarkerOptions): Marker? {
val marker = delegate.addMarker(options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ package com.example.snippets.kotlin.annotations
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class SnippetGroup(
val title: String,
val description: String = "",
)
annotation class SnippetGroup(val title: String, val description: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ package com.example.snippets.kotlin.annotations
*/
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class SnippetItem(
val title: String,
val description: String = "",
)
annotation class SnippetItem(val title: String, val description: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class CameraControlSnippets(
@Suppress("unused")
@SnippetItem(
title = "1. Fly To",
description = "Animates the camera to a specific position with a tilt and heading over 5 seconds.",
description = "Animates the camera to a specific position with a tilt and heading over " +
"5 seconds.",
)
fun flyCameraToPosition() {
// [START maps_android_3d_camera_fly_to_kt]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class MapInitSnippets {
@Suppress("unused")
@SnippetItem(
title = "2. Add Map to AndroidView",
description = "Shows how to add a Map3DView to an AndroidView which bridges to Jetpack Compose.",
description = "Shows how to add a Map3DView to an AndroidView which bridges to " +
"Jetpack Compose.",
)
fun BasicMap3D() {
AndroidView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import com.google.android.gms.maps3d.model.vector3D
)
class ModelSnippets(private val context: Context, private val map: TrackedMap3D) {
companion object {
const val SAUCER_URL = "https://storage.googleapis.com/gmp-maps-demos/p3d-map/assets/UFO.glb"
const val SAUCER_URL =
"https://storage.googleapis.com/gmp-maps-demos/p3d-map/assets/UFO.glb"
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class PlaceSnippets(private val context: Context, private val map: TrackedMap3D)
@Suppress("unused")
@SnippetItem(
title = "1. Listen Clicks",
description = "Sets up a listener that logs the Place ID when a user clicks on a 3D building or POI.",
description = "Sets up a listener that logs the Place ID when a user clicks on a " +
"3D building or POI.",
)
fun listenToPlaceClicks() {
// [START maps_android_3d_place_click_kt]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class PolygonSnippets(private val context: Context, private val map: TrackedMap3
@Suppress("unused")
@SnippetItem(
title = "2. Extruded",
description = "Draws a semi-transparent red extruded polygon (height 50m) around a small area",
description = "Draws a semi-transparent red extruded polygon (height 50m) around a " +
"small area",
)
fun addExtrudedPolygon() {
// [START maps_android_3d_polygon_extruded_kt]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ class PolylineSnippets(private val context: Context, private val map: TrackedMap
@Suppress("unused")
@SnippetItem(
title = "2. Styled",
description = "Draws a magenta polyline with a green outline, extruded and following the ground curvature (geodesic), connecting two points.",
description = "Draws a magenta polyline with a green outline, extruded and following the " +
"ground curvature (geodesic), connecting two points.",
)
fun addStyledPolyline() {
// [START maps_android_3d_polyline_options_kt]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class PopoverSnippets(private val context: Context, private val map: TrackedMap3
@Suppress("unused")
@SnippetItem(
title = "2. Configured",
description = "Adds an 'Info' popover anchored to a marker with auto-close enabled and auto-pan disabled.",
description = "Adds an 'Info' popover anchored to a marker with auto-close enabled and " +
"auto-pan disabled.",
)
fun addConfiguredPopover() {
// [START maps_android_3d_popover_options_kt]
Expand Down
Loading