Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge latest #1

Merged
merged 33 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2a26049
chore: fixed GitHub actions configuration file (#331)
kikoso Jul 17, 2023
4e149ee
chore: fix issue with CI/CD in the instrumentation tests (#349)
kikoso Jul 24, 2023
d6b3aa0
chore: Synced file(s) with googlemaps/.github (#350)
googlemaps-bot Jul 25, 2023
c8673cd
chore: Synced local '.github/' with remote 'sync-files/android/.githu…
googlemaps-bot Jul 25, 2023
93b9b85
fix: fixed crash when the Bitmap size is zero in the ClusterRenderer …
kikoso Jul 25, 2023
4de34d8
chore(release): 2.11.5 [skip ci]
semantic-release-bot Jul 25, 2023
23d0a9b
chore: Update README.md
wangela Jul 26, 2023
17738b6
feat: update Google Maps SDK to 18.1.0 (#338)
kikoso Jul 26, 2023
17822fa
chore(release): 2.12.0 [skip ci]
semantic-release-bot Jul 26, 2023
e46fdf2
chore: fix Street View location in README (#346) (#345)
lawm Jul 28, 2023
2422f06
chore: Improve Scalebar example in readme (#343)
DarrylBayliss Jul 28, 2023
1974583
feat: added Factory for Map (#353)
kikoso Aug 7, 2023
006ddd6
chore(release): 2.13.0 [skip ci]
semantic-release-bot Aug 7, 2023
6776b6b
docs: added documentation for the GoogleMapFactory (#363)
kikoso Aug 8, 2023
d64e944
chore: Update dependabot.yml
wangela Aug 8, 2023
82f6587
Update dependabot.yml
wangela Aug 8, 2023
ec4bef2
chore(deps): bump maps from 3.3.0 to 3.4.0 (#367)
dependabot[bot] Aug 8, 2023
1bd915c
fix: fix test for swiping on map in column (#379)
kikoso Aug 17, 2023
b2e0a71
chore(release): 2.13.1 [skip ci]
semantic-release-bot Aug 17, 2023
51bb2bf
feat: customize Marker using MarkerComposable (#355)
mosmb Aug 17, 2023
6a85b0a
chore(release): 2.14.0 [skip ci]
semantic-release-bot Aug 17, 2023
dc743a2
chore: Make all listeners null by default (#320)
romainpiel Sep 13, 2023
ff3f98b
fix: fixed issue when multiple marker managers have been added, for i…
kikoso Sep 14, 2023
a68642d
chore(release): 2.14.1 [skip ci]
semantic-release-bot Sep 14, 2023
f6baafc
feat: updating configuration to generate multimodule documentation (#…
kikoso Sep 22, 2023
57bd10c
chore(release): 2.15.0 [skip ci]
semantic-release-bot Sep 22, 2023
16cd89e
chore: update dependencies (#377)
kikoso Sep 27, 2023
3ebb6fd
feat!: add custom ClusterRenderer (#360)
kikoso Oct 2, 2023
49f73f8
chore: update semantic-release config (#416)
wangela Oct 3, 2023
410a047
chore: update release.yml
wangela Oct 3, 2023
dff9276
Revert "chore: update semantic-release config (#416)" (#417)
wangela Oct 3, 2023
9456fec
breaking: simplify dependencies
kikoso Oct 3, 2023
8c6c3b0
chore(release): 3.0.0 [skip ci]
semantic-release-bot Oct 3, 2023
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
28 changes: 14 additions & 14 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@

version: 2
updates:
- package-ecosystem: gradle
directory: "/./app"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
commit-message:
prefix: chore(deps)
- package-ecosystem: gradle
directory: "/./maps-compose"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
commit-message:
prefix: chore(deps)
- package-ecosystem: "gradle" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
open-pull-requests-limit: 10
commit-message:
prefix: chore(deps)
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
open-pull-requests-limit: 10
commit-message:
prefix: chore(deps)
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ jobs:
- name: Gradle Wrapper Validation
uses: gradle/[email protected]

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'

# Run dokka and create tar
- name: Generate documentation
run: |
./gradlew dokkaHtml
./gradlew dokkaHtmlMultiModule

echo "Creating tar for generated docs"
cd $GITHUB_WORKSPACE/maps-compose/build/dokka/html && tar cvf ~/maps-compose-docs.tar .
cd $GITHUB_WORKSPACE/build/dokka/htmlMultiModule && tar cvf ~/maps-compose-docs.tar .

echo "Unpacking tar into gh-pages branch"
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/instrumentation-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ jobs:
- name: Gradle Wrapper Validation
uses: gradle/[email protected]

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'

- name: Inject Maps API Key
run: |
echo MAPS_API_KEY=$MAPS_API_KEY >> ./local.properties
env:
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }}
run: |
[ -z "$MAPS_API_KEY" ] && MAPS_API_KEY="YOUR_API_KEY"; echo "MAPS_API_KEY=$MAPS_API_KEY" >> ./local.properties

- name: Build debug
run: ./gradlew assembleDebug
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
with:
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
- uses: gradle/[email protected]
- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '17'
distribution: 'adopt'
- name: Create .gpg key
run: |
echo $GPG_KEY_ARMOR | base64 --decode > ./release.asc
Expand All @@ -45,15 +50,23 @@ jobs:
GPG_PASSWORD: ${{ secrets.SYNCED_GPG_KEY_PASSWORD }}
SONATYPE_PASSWORD: ${{ secrets.SYNCED_SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SYNCED_SONATYPE_USERNAME }}

- uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install conventionalcommits
run: npm i -D conventional-changelog-conventionalcommits

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
uses: cycjimmy/semantic-release-action@v3.4.1
with:
extra_plugins: |
"@semantic-release/commit-analyzer"
"@semantic-release/release-notes-generator"
"@google/semantic-release-replace-plugin"
"@semantic-release/exec"
"@semantic-release/git
"@semantic-release/github
"@semantic-release/commit-analyzer@8.0.1"
"@semantic-release/release-notes-generator@9.0.3"
"@google/semantic-release-replace-plugin@1.2.0"
"@semantic-release/exec@5.0.0"
"@semantic-release/git@9.0.1"
"@semantic-release/github@7.2.3"
env:
GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
pull_request:
branches-ignore: ['gh-pages']
workflow_dispatch:
workflow_call:

jobs:
test:
Expand All @@ -36,10 +37,10 @@ jobs:
- name: Gradle Wrapper Validation
uses: gradle/[email protected]

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Build modules
Expand Down
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins:
to: "version = '${nextRelease.version}'"
- files:
- "README.md"
from: ":[0-9].[0-9].[0-9]"
from: ":([0-9]+).([0-9]+).([0-9]+)"
to: ":${nextRelease.version}"
- - "@semantic-release/exec"
- prepareCmd: "./gradlew build --warn --stacktrace"
Expand Down
63 changes: 47 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ This repository contains [Jetpack Compose][jetpack-compose] components for the [

## Installation

You no longer need to specify the Maps SDK for Android or its Utility Library as separate dependencies, since `maps-compose` and `maps-compose-utils` pull in the appropriate versions of these respectively.

```groovy
dependencies {
implementation 'com.google.maps.android:maps-compose:2.11.2'

// Make sure to also include the latest version of the Maps SDK for Android
implementation 'com.google.android.gms:play-services-maps:18.0.2'

implementation 'com.google.maps.android:maps-compose:3.0.0'

// Optionally, you can include the Compose utils library for Clustering, etc.
implementation 'com.google.maps.android:maps-compose-utils:2.11.2'
implementation 'com.google.maps.android:maps-compose-utils:3.0.0'

// Optionally, you can include the widgets library for ScaleBar, etc.
implementation 'com.google.maps.android:maps-compose-widgets:2.11.2'
implementation 'com.google.maps.android:maps-compose-widgets:3.0.0'
}
```

Expand Down Expand Up @@ -172,6 +171,26 @@ GoogleMap(
}
```

You can also customize the marker you want to add by using `MarkerComposable`.

```kotlin
val state = MyState()

GoogleMap(
//...
) {
MarkerComposable(
keys = arrayOf(state),
state = MarkerState(position = LatLng(-34, 151)),
) {
MyCustomMarker(state)
}
}
```
As this Composable is backed by a rendering of your Composable into a Bitmap, it will not render
your Composable every recomposition. So to trigger a new render of your Composable, you can pass
all variables that your Composable depends on to trigger a render whenever one of them change.

</details>

<details>
Expand Down Expand Up @@ -214,7 +233,7 @@ You can add a Street View given a location using the `StreetView` composable.
To use it, provide a `StreetViewPanoramaOptions` object as follows:

```kotlin
val singapore = LatLng(1.35, 103.87)
val singapore = LatLng(1.3588227, 103.8742114)
StreetView(
streetViewPanoramaOptionsFactory = {
StreetViewPanoramaOptions().position(singapore)
Expand Down Expand Up @@ -285,19 +304,31 @@ The [ScaleBarActivity](app/src/main/java/com/google/maps/android/compose/ScaleBa
Both versions of this widget leverage the `CameraPositionState` in `maps-compose` and therefore are very simple to configure with their defaults:

```kotlin
ScaleBar(
modifier = Modifier
Box(Modifier.fillMaxSize()) {

GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState
) {
// ... your map composables ...
}

ScaleBar(
modifier = Modifier
.padding(top = 5.dp, end = 15.dp)
.align(Alignment.TopEnd),
cameraPositionState = cameraPositionState
)
cameraPositionState = cameraPositionState
)

// OR

DisappearingScaleBar(
modifier = Modifier
DisappearingScaleBar(
modifier = Modifier
.padding(top = 5.dp, end = 15.dp)
.align(Alignment.TopStart),
cameraPositionState = cameraPositionState
)
cameraPositionState = cameraPositionState
)
}
```

The colors of the text, line, and shadow are also all configurable (e.g., based on `isSystemInDarkTheme()` on a dark map). Similarly, the `DisappearingScaleBar` animations can be configured.
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ plugins {

android {
namespace "com.google.maps.android.compose"
compileSdk 33
compileSdk 34

defaultConfig {
minSdk 21
targetSdk 33
targetSdk 34
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -45,7 +45,6 @@ dependencies {
implementation libs.kotlin
implementation libs.material
implementation libs.maps.ktx.std
implementation libs.maps.utils
implementation libs.androidx.compose.ui.preview.tooling
debugImplementation libs.androidx.compose.ui.tooling

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

package com.google.maps.android.compose

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assertIsDisplayed
Expand Down Expand Up @@ -210,6 +212,29 @@ class GoogleMapViewTests {
}
}

@Test(expected = IllegalStateException::class)
fun testMarkerStateInsideMarkerComposableCannotBeReused() {
initMap {
val markerState = rememberMarkerState()
MarkerComposable(
keys = arrayOf("marker1"),
state = markerState,
) {
Box {
Text(text = "marker1")
}
}
MarkerComposable(
keys = arrayOf("marker2"),
state = markerState,
) {
Box {
Text(text = "marker2")
}
}
}
}

@Test
fun testCameraPositionStateMapClears() {
initMap()
Expand All @@ -234,4 +259,4 @@ class GoogleMapViewTests {

assertionBlock()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 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 @@ -130,18 +130,17 @@ class MapInColumnTests {
startingPosition.assertEquals(cameraPositionState.position.target)
}

// @Test
// fun testPanMapUp_MapCameraChangesColumnDoesNotScroll() {
// initMap()
// // Swipe the map up
// // FIXME - for some reason this scrolls the entire column instead of just the map
// composeTestRule.onNodeWithTag("Map").performTouchInput { swipeUp() }
// composeTestRule.waitForIdle()
//
// // Make sure that the map changed (i.e., we can scroll the map in the column)
// startingPosition.assertNotEquals(cameraPositionState.position.target)
//
// // Check to make sure column didn't scroll
// composeTestRule.onNodeWithTag("Item 1").assertIsDisplayed()
// }
@Test
fun testPanMapUp_MapCameraChangesColumnDoesNotScroll() {
initMap()
//Swipe the map up
composeTestRule.onNodeWithTag("Map").performTouchInput { swipeUp() }
composeTestRule.waitForIdle()

//Make sure that the map changed (i.e., we can scroll the map in the column)
assertNotEquals(startingPosition, cameraPositionState.position.target)

//Check to make sure column didn't scroll
composeTestRule.onNodeWithTag("Item 1").assertIsDisplayed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class StreetViewTests {
onClick = onClick
)
}
composeTestRule.waitUntil(8000) {
composeTestRule.waitUntil(10000) {
cameraPositionState.location.position.latitude != 0.0 &&
cameraPositionState.location.position.longitude != 0.0
}
Expand Down
Loading