Skip to content

Commit 3b07650

Browse files
authored
Merge branch 'main' into wescpy
2 parents 818edcf + 212f3af commit 3b07650

File tree

24 files changed

+214
-38
lines changed

24 files changed

+214
-38
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ jobs:
6060
commit-message: 'docs: Update docs'
6161
author: googlemaps-bot <[email protected]>
6262
committer: googlemaps-bot <[email protected]>
63-
labels: docs
63+
labels: |
64+
docs
65+
automerge
6466
title: 'docs: Update docs'
6567
body: |
6668
Updated GitHub pages with latest from `./gradlew dokkaHtml`.

.github/workflows/test.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 Google LLC
1+
# Copyright 2024 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -45,3 +45,13 @@ jobs:
4545

4646
- name: Build modules
4747
run: ./gradlew build jacocoTestReport --stacktrace
48+
49+
- name: Run Screenshot Tests
50+
run: ./gradlew validateDebugScreenshotTest
51+
52+
- name: Upload build reports
53+
uses: actions/upload-artifact@v4
54+
if: always()
55+
with:
56+
name: my-artifact
57+
path: app/build/reports

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.iml
22
.idea
33
.gradle
4+
.kotlin
45
/local.properties
56
/.idea/caches
67
/.idea/libraries

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ You no longer need to specify the Maps SDK for Android or its Utility Library as
2828

2929
```groovy
3030
dependencies {
31-
implementation 'com.google.maps.android:maps-compose:6.2.1'
31+
implementation 'com.google.maps.android:maps-compose:6.4.0'
3232
3333
// Optionally, you can include the Compose utils library for Clustering,
3434
// Street View metadata checks, etc.
35-
implementation 'com.google.maps.android:maps-compose-utils:6.2.1'
35+
implementation 'com.google.maps.android:maps-compose-utils:6.4.0'
3636
3737
// Optionally, you can include the widgets library for ScaleBar, etc.
38-
implementation 'com.google.maps.android:maps-compose-widgets:6.2.1'
38+
implementation 'com.google.maps.android:maps-compose-widgets:6.4.0'
3939
}
4040
```
4141

app/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
id("kotlin-android")
44
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
55
alias(libs.plugins.compose.compiler)
6+
alias(libs.plugins.screenshot)
67
}
78

89
android {
@@ -46,6 +47,14 @@ android {
4647
jvmTarget = "1.8"
4748
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
4849
}
50+
51+
experimentalProperties["android.experimental.enableScreenshotTest"] = true
52+
53+
testOptions {
54+
screenshotTests {
55+
imageDifferenceThreshold = 0.035f // 3.5%
56+
}
57+
}
4958
}
5059

5160
dependencies {
@@ -68,6 +77,8 @@ dependencies {
6877
androidTestImplementation(libs.androidx.test.compose.ui)
6978
androidTestImplementation(libs.kotlinx.coroutines.test)
7079

80+
screenshotTestImplementation(libs.androidx.compose.ui.tooling)
81+
7182
// Instead of the lines below, regular apps would load these libraries from Maven according to
7283
// the README installation instructions
7384
implementation(project(":maps-compose"))
2.77 KB
Loading
2.77 KB
Loading

app/src/main/java/com/google/maps/android/compose/ScaleBarActivity.kt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,18 @@ import androidx.compose.foundation.layout.systemBarsPadding
3131
import androidx.compose.foundation.layout.wrapContentSize
3232
import androidx.compose.material.CircularProgressIndicator
3333
import androidx.compose.material.MaterialTheme
34+
import androidx.compose.runtime.Composable
3435
import androidx.compose.runtime.getValue
3536
import androidx.compose.runtime.mutableStateOf
3637
import androidx.compose.runtime.remember
3738
import androidx.compose.runtime.setValue
3839
import androidx.compose.ui.Alignment
3940
import androidx.compose.ui.Modifier
41+
import androidx.compose.ui.tooling.preview.Preview
4042
import androidx.compose.ui.unit.dp
43+
import com.google.android.gms.maps.model.CameraPosition
44+
import com.google.android.gms.maps.model.LatLng
45+
import com.google.maps.android.compose.theme.MapsComposeSampleTheme
4146
import com.google.maps.android.compose.widgets.DarkGray
4247
import com.google.maps.android.compose.widgets.DisappearingScaleBar
4348
import com.google.maps.android.compose.widgets.ScaleBar
@@ -126,4 +131,26 @@ class ScaleBarActivity : ComponentActivity() {
126131
}
127132
}
128133
}
134+
}
135+
136+
@Preview
137+
@Composable
138+
fun PreviewScaleBar() {
139+
val cameraPositionState = remember {
140+
CameraPositionState(
141+
position = CameraPosition(
142+
LatLng(48.137154, 11.576124), // Example coordinates: Munich, Germany
143+
12f,
144+
0f,
145+
0f
146+
)
147+
)
148+
}
149+
150+
MapsComposeSampleTheme {
151+
ScaleBar(
152+
modifier = Modifier.padding(end = 4.dp),
153+
cameraPositionState = cameraPositionState
154+
)
155+
}
129156
}

app/src/main/java/com/google/maps/android/compose/markerexamples/MarkerClusteringActivity.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import com.google.android.gms.maps.model.CameraPosition
4242
import com.google.android.gms.maps.model.LatLng
4343
import com.google.maps.android.clustering.ClusterItem
4444
import com.google.maps.android.clustering.algo.NonHierarchicalViewBasedAlgorithm
45+
import com.google.maps.android.clustering.view.DefaultClusterRenderer
4546
import com.google.maps.android.compose.GoogleMap
4647
import com.google.maps.android.compose.MapsComposeExperimentalApi
4748
import com.google.maps.android.compose.MarkerInfoWindow
@@ -181,7 +182,11 @@ private fun CustomUiClustering(items: List<MyItem>) {
181182
)
182183
},
183184
// Optional: Custom rendering for non-clustered items
184-
clusterItemContent = null
185+
clusterItemContent = null,
186+
// Optional: Customization hook for clusterManager and renderer when they're ready
187+
onClusterManager = { clusterManager ->
188+
(clusterManager.renderer as DefaultClusterRenderer).minClusterSize = 2
189+
},
185190
)
186191
}
187192

@@ -218,6 +223,7 @@ fun CustomRendererClustering(items: List<MyItem>) {
218223
},
219224
clusterManager = clusterManager,
220225
)
226+
221227
SideEffect {
222228
clusterManager ?: return@SideEffect
223229
clusterManager.setOnClusterClickListener {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.google.maps.android.compose
2+
3+
import androidx.compose.foundation.layout.padding
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.runtime.remember
6+
import androidx.compose.ui.Modifier
7+
import androidx.compose.ui.tooling.preview.Preview
8+
import androidx.compose.ui.unit.dp
9+
import com.google.android.gms.maps.model.CameraPosition
10+
import com.google.android.gms.maps.model.LatLng
11+
import com.google.maps.android.compose.theme.MapsComposeSampleTheme
12+
import com.google.maps.android.compose.widgets.DisappearingScaleBar
13+
import com.google.maps.android.compose.widgets.ScaleBar
14+
15+
16+
class ScaleBarTest() {
17+
@Preview
18+
@Composable
19+
fun PreviewScaleBar() {
20+
val cameraPositionState = remember {
21+
CameraPositionState(
22+
position = CameraPosition(
23+
LatLng(48.137154, 11.576124), // Example coordinates: Munich, Germany
24+
12f,
25+
0f,
26+
0f
27+
)
28+
)
29+
}
30+
31+
MapsComposeSampleTheme {
32+
ScaleBar(
33+
modifier = Modifier.padding(end = 4.dp),
34+
cameraPositionState = cameraPositionState
35+
)
36+
}
37+
}
38+
39+
@Preview
40+
@Composable
41+
fun PreviewDisappearingScaleBar() {
42+
val cameraPositionState = remember {
43+
CameraPositionState(
44+
position = CameraPosition(
45+
LatLng(48.137154, 11.576124), // Example coordinates: Munich, Germany
46+
12f,
47+
0f,
48+
0f
49+
)
50+
)
51+
}
52+
53+
MapsComposeSampleTheme {
54+
DisappearingScaleBar(
55+
modifier = Modifier.padding(end = 4.dp),
56+
cameraPositionState = cameraPositionState
57+
)
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)