Skip to content

Commit

Permalink
Merge branch 'main' into wescpy
Browse files Browse the repository at this point in the history
  • Loading branch information
wescpy authored Dec 21, 2024
2 parents 818edcf + 212f3af commit 3b07650
Show file tree
Hide file tree
Showing 24 changed files with 214 additions and 38 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ jobs:
commit-message: 'docs: Update docs'
author: googlemaps-bot <googlemaps-bot@google.com>
committer: googlemaps-bot <googlemaps-bot@google.com>
labels: docs
labels: |
docs
automerge
title: 'docs: Update docs'
body: |
Updated GitHub pages with latest from `./gradlew dokkaHtml`.
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,3 +45,13 @@ jobs:

- name: Build modules
run: ./gradlew build jacocoTestReport --stacktrace

- name: Run Screenshot Tests
run: ./gradlew validateDebugScreenshotTest

- name: Upload build reports
uses: actions/upload-artifact@v4
if: always()
with:
name: my-artifact
path: app/build/reports
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.iml
.idea
.gradle
.kotlin
/local.properties
/.idea/caches
/.idea/libraries
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ You no longer need to specify the Maps SDK for Android or its Utility Library as

```groovy
dependencies {
implementation 'com.google.maps.android:maps-compose:6.2.1'
implementation 'com.google.maps.android:maps-compose:6.4.0'
// Optionally, you can include the Compose utils library for Clustering,
// Street View metadata checks, etc.
implementation 'com.google.maps.android:maps-compose-utils:6.2.1'
implementation 'com.google.maps.android:maps-compose-utils:6.4.0'
// Optionally, you can include the widgets library for ScaleBar, etc.
implementation 'com.google.maps.android:maps-compose-widgets:6.2.1'
implementation 'com.google.maps.android:maps-compose-widgets:6.4.0'
}
```

Expand Down
11 changes: 11 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id("kotlin-android")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
alias(libs.plugins.compose.compiler)
alias(libs.plugins.screenshot)
}

android {
Expand Down Expand Up @@ -46,6 +47,14 @@ android {
jvmTarget = "1.8"
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}

experimentalProperties["android.experimental.enableScreenshotTest"] = true

testOptions {
screenshotTests {
imageDifferenceThreshold = 0.035f // 3.5%
}
}
}

dependencies {
Expand All @@ -68,6 +77,8 @@ dependencies {
androidTestImplementation(libs.androidx.test.compose.ui)
androidTestImplementation(libs.kotlinx.coroutines.test)

screenshotTestImplementation(libs.androidx.compose.ui.tooling)

// Instead of the lines below, regular apps would load these libraries from Maven according to
// the README installation instructions
implementation(project(":maps-compose"))
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.compose.theme.MapsComposeSampleTheme
import com.google.maps.android.compose.widgets.DarkGray
import com.google.maps.android.compose.widgets.DisappearingScaleBar
import com.google.maps.android.compose.widgets.ScaleBar
Expand Down Expand Up @@ -126,4 +131,26 @@ class ScaleBarActivity : ComponentActivity() {
}
}
}
}

@Preview
@Composable
fun PreviewScaleBar() {
val cameraPositionState = remember {
CameraPositionState(
position = CameraPosition(
LatLng(48.137154, 11.576124), // Example coordinates: Munich, Germany
12f,
0f,
0f
)
)
}

MapsComposeSampleTheme {
ScaleBar(
modifier = Modifier.padding(end = 4.dp),
cameraPositionState = cameraPositionState
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.clustering.ClusterItem
import com.google.maps.android.clustering.algo.NonHierarchicalViewBasedAlgorithm
import com.google.maps.android.clustering.view.DefaultClusterRenderer
import com.google.maps.android.compose.GoogleMap
import com.google.maps.android.compose.MapsComposeExperimentalApi
import com.google.maps.android.compose.MarkerInfoWindow
Expand Down Expand Up @@ -181,7 +182,11 @@ private fun CustomUiClustering(items: List<MyItem>) {
)
},
// Optional: Custom rendering for non-clustered items
clusterItemContent = null
clusterItemContent = null,
// Optional: Customization hook for clusterManager and renderer when they're ready
onClusterManager = { clusterManager ->
(clusterManager.renderer as DefaultClusterRenderer).minClusterSize = 2
},
)
}

Expand Down Expand Up @@ -218,6 +223,7 @@ fun CustomRendererClustering(items: List<MyItem>) {
},
clusterManager = clusterManager,
)

SideEffect {
clusterManager ?: return@SideEffect
clusterManager.setOnClusterClickListener {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.google.maps.android.compose

import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.compose.theme.MapsComposeSampleTheme
import com.google.maps.android.compose.widgets.DisappearingScaleBar
import com.google.maps.android.compose.widgets.ScaleBar


class ScaleBarTest() {
@Preview
@Composable
fun PreviewScaleBar() {
val cameraPositionState = remember {
CameraPositionState(
position = CameraPosition(
LatLng(48.137154, 11.576124), // Example coordinates: Munich, Germany
12f,
0f,
0f
)
)
}

MapsComposeSampleTheme {
ScaleBar(
modifier = Modifier.padding(end = 4.dp),
cameraPositionState = cameraPositionState
)
}
}

@Preview
@Composable
fun PreviewDisappearingScaleBar() {
val cameraPositionState = remember {
CameraPositionState(
position = CameraPosition(
LatLng(48.137154, 11.576124), // Example coordinates: Munich, Germany
12f,
0f,
0f
)
)
}

MapsComposeSampleTheme {
DisappearingScaleBar(
modifier = Modifier.padding(end = 4.dp),
cameraPositionState = cameraPositionState
)
}
}
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ val projectArtifactId by extra { project: Project ->

allprojects {
group = "com.google.maps.android"
version = "6.2.1"
version = "6.4.0"
val projectArtifactId by extra { project.name }
}

Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ sonatypeToken=
sonatypeTokenPassword=

android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.nonFinalResIds=false

android.experimental.enableScreenshotTest=true
13 changes: 8 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[versions]
activitycompose = "1.9.3"
agp = "8.7.2"
androidxtest = "1.6.1"
compose-bom = "2024.10.01"
androidxtest = "1.6.2"
androidCore = "1.6.1"
compose-bom = "2024.11.00"
dokka = "1.9.20"
espresso = "3.6.1"
jacoco-plugin = "0.2.1"
Expand All @@ -14,6 +15,7 @@ mapsktx = "5.1.1"
mapsecrets = "2.0.1"
org-jacoco-core = "0.8.11"
androidx-core = "1.15.0"
screenshot = "0.0.1-alpha08"

[libraries]
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }
Expand All @@ -26,10 +28,10 @@ androidx-compose-ui-preview-tooling = { module = "androidx.compose.ui:ui-tooling
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
androidx-test-compose-ui = { module = "androidx.compose.ui:ui-test-junit4" }
androidx-test-core = { module = "androidx.test:core", version.ref = "androidxtest" }
androidx-test-core = { module = "androidx.test:core", version.ref = "androidCore" }
androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
androidx-test-junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "junitktx" }
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidxtest" }
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidCore" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidxtest" }
dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
jacoco-android-plugin = { module = "com.mxalbert.gradle:jacoco-android", version.ref = "jacoco-plugin", version.require = "0.2.1" }
Expand All @@ -45,4 +47,5 @@ test-junit = { module = "junit:junit", version.ref = "junit" }

[plugins]
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
screenshot = { id = "com.android.compose.screenshot", version.ref = "screenshot"}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
1 change: 0 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#Wed Oct 16 09:55:51 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion maps-compose-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
}

namespace = "com.google.maps.android.compose.utils"
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
Loading

0 comments on commit 3b07650

Please sign in to comment.