├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── support_request.md ├── blunderbuss.yml ├── dependabot.yml ├── header-checker-lint.yml ├── pull_request_template.md ├── stale.yml ├── sync-repo-settings.yaml └── workflows │ ├── docs.yml │ ├── lint-report.yml │ ├── release.yml │ ├── report.yml │ └── test.yml ├── .gitignore ├── .releaserc ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── LICENSE ├── README.md ├── RELEASING.md ├── SECURITY.md ├── build-logic ├── .gitignore ├── convention │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── kotlin │ │ └── PublishingConventionPlugin.kt └── settings.gradle.kts ├── build.gradle.kts ├── demo ├── .gitignore ├── V3_FILE_HEADER ├── build.gradle.kts ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── maps │ │ │ └── android │ │ │ └── utils │ │ │ └── demo │ │ │ ├── AnimationUtilDemoActivity.java │ │ │ ├── ApiKeyValidator.kt │ │ │ ├── BaseDemoActivity.java │ │ │ ├── BigClusteringDemoActivity.java │ │ │ ├── ClusteringDemoActivity.java │ │ │ ├── ClusteringDiffDemoActivity.java │ │ │ ├── ClusteringViewModel.java │ │ │ ├── ClusteringViewModelDemoActivity.java │ │ │ ├── CustomAdvancedMarkerClusteringDemoActivity.java │ │ │ ├── CustomMarkerClusteringDemoActivity.java │ │ │ ├── DistanceDemoActivity.java │ │ │ ├── GeoJsonDemoActivity.java │ │ │ ├── HeatmapsDemoActivity.java │ │ │ ├── HeatmapsPlacesDemoActivity.java │ │ │ ├── IconGeneratorDemoActivity.java │ │ │ ├── KmlDemoActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── MultiDrawable.java │ │ │ ├── MultiLayerDemoActivity.java │ │ │ ├── MyItemReader.java │ │ │ ├── PolyDecodeDemoActivity.java │ │ │ ├── PolySimplifyDemoActivity.java │ │ │ ├── StreetViewDemoActivity.kt │ │ │ ├── TileProviderAndProjectionDemo.java │ │ │ ├── VisibleClusteringDemoActivity.java │ │ │ ├── ZoomClusteringDemoActivity.java │ │ │ └── model │ │ │ ├── MyItem.java │ │ │ └── Person.java │ └── res │ │ ├── drawable-nodpi │ │ ├── gran.jpg │ │ ├── ic_launcher.png │ │ ├── john.jpg │ │ ├── mechanic.jpg │ │ ├── ruth.jpg │ │ ├── stefan.jpg │ │ ├── teacher.jpg │ │ ├── turtle.jpg │ │ ├── walter.jpg │ │ └── yeats.jpg │ │ ├── layout │ │ ├── custom_info_window.xml │ │ ├── distance_demo.xml │ │ ├── geojson_demo.xml │ │ ├── heatmaps_demo.xml │ │ ├── kml_demo.xml │ │ ├── main.xml │ │ ├── map.xml │ │ ├── map_with_floating_button.xml │ │ ├── multi_profile.xml │ │ ├── places_demo.xml │ │ └── street_view_demo.xml │ │ ├── raw │ │ ├── campus.kml │ │ ├── earthquakes.json │ │ ├── earthquakes_with_usa.json │ │ ├── kmlgeometrytest.kml │ │ ├── medicare.json │ │ ├── police.json │ │ ├── radar_search.json │ │ ├── south_london_line_geojson.json │ │ ├── south_london_line_kml.kml │ │ ├── south_london_square_geojson.json │ │ ├── south_london_square_kml.kml │ │ └── usa.json │ │ └── values │ │ ├── colors.xml │ │ ├── dimensions.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── google │ └── maps │ └── android │ └── utils │ └── demo │ └── ApiKeyValidatorTest.kt ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── maps │ │ │ └── android │ │ │ ├── MathUtil.java │ │ │ ├── PolyUtil.java │ │ │ ├── RendererLogger.java │ │ │ ├── SphericalUtil.java │ │ │ ├── StreetViewUtil.kt │ │ │ ├── clustering │ │ │ ├── Cluster.java │ │ │ ├── ClusterItem.java │ │ │ ├── ClusterManager.java │ │ │ ├── algo │ │ │ │ ├── AbstractAlgorithm.java │ │ │ │ ├── Algorithm.java │ │ │ │ ├── CentroidNonHierarchicalDistanceBasedAlgorithm.java │ │ │ │ ├── GridBasedAlgorithm.java │ │ │ │ ├── NonHierarchicalDistanceBasedAlgorithm.java │ │ │ │ ├── NonHierarchicalViewBasedAlgorithm.java │ │ │ │ ├── PreCachingAlgorithmDecorator.java │ │ │ │ ├── ScreenBasedAlgorithm.java │ │ │ │ ├── ScreenBasedAlgorithmAdapter.java │ │ │ │ └── StaticCluster.java │ │ │ └── view │ │ │ │ ├── ClusterRenderer.java │ │ │ │ ├── ClusterRendererMultipleItems.java │ │ │ │ ├── DefaultAdvancedMarkersClusterRenderer.java │ │ │ │ └── DefaultClusterRenderer.java │ │ │ ├── collections │ │ │ ├── CircleManager.java │ │ │ ├── GroundOverlayManager.java │ │ │ ├── MapObjectManager.java │ │ │ ├── MarkerManager.java │ │ │ ├── PolygonManager.java │ │ │ └── PolylineManager.java │ │ │ ├── data │ │ │ ├── DataPolygon.java │ │ │ ├── Feature.java │ │ │ ├── Geometry.java │ │ │ ├── Layer.java │ │ │ ├── LineString.java │ │ │ ├── MultiGeometry.java │ │ │ ├── Point.java │ │ │ ├── Renderer.java │ │ │ ├── Style.java │ │ │ ├── geojson │ │ │ │ ├── BiMultiMap.java │ │ │ │ ├── GeoJsonFeature.java │ │ │ │ ├── GeoJsonGeometryCollection.java │ │ │ │ ├── GeoJsonLayer.java │ │ │ │ ├── GeoJsonLineString.java │ │ │ │ ├── GeoJsonLineStringStyle.java │ │ │ │ ├── GeoJsonMultiLineString.java │ │ │ │ ├── GeoJsonMultiPoint.java │ │ │ │ ├── GeoJsonMultiPolygon.java │ │ │ │ ├── GeoJsonParser.java │ │ │ │ ├── GeoJsonPoint.java │ │ │ │ ├── GeoJsonPointStyle.java │ │ │ │ ├── GeoJsonPolygon.java │ │ │ │ ├── GeoJsonPolygonStyle.java │ │ │ │ ├── GeoJsonRenderer.java │ │ │ │ └── GeoJsonStyle.java │ │ │ └── kml │ │ │ │ ├── KmlBoolean.java │ │ │ │ ├── KmlContainer.java │ │ │ │ ├── KmlContainerParser.java │ │ │ │ ├── KmlFeatureParser.java │ │ │ │ ├── KmlGroundOverlay.java │ │ │ │ ├── KmlLayer.java │ │ │ │ ├── KmlLineString.java │ │ │ │ ├── KmlMultiGeometry.java │ │ │ │ ├── KmlMultiTrack.java │ │ │ │ ├── KmlParser.java │ │ │ │ ├── KmlPlacemark.java │ │ │ │ ├── KmlPoint.java │ │ │ │ ├── KmlPolygon.java │ │ │ │ ├── KmlRenderer.java │ │ │ │ ├── KmlStyle.java │ │ │ │ ├── KmlStyleParser.java │ │ │ │ ├── KmlTrack.java │ │ │ │ └── KmlUtil.java │ │ │ ├── geometry │ │ │ ├── Bounds.java │ │ │ └── Point.java │ │ │ ├── heatmaps │ │ │ ├── Gradient.java │ │ │ ├── HeatmapTileProvider.java │ │ │ └── WeightedLatLng.java │ │ │ ├── projection │ │ │ ├── Point.java │ │ │ └── SphericalMercatorProjection.java │ │ │ ├── quadtree │ │ │ └── PointQuadTree.java │ │ │ └── ui │ │ │ ├── AnimationUtil.java │ │ │ ├── BubbleDrawable.java │ │ │ ├── BubbleIconFactory.java │ │ │ ├── IconGenerator.java │ │ │ ├── RotationLayout.java │ │ │ └── SquareTextView.java │ └── res │ │ ├── drawable-xhdpi │ │ ├── amu_bubble_mask.9.png │ │ └── amu_bubble_shadow.9.png │ │ ├── drawable-xxhdpi │ │ ├── amu_bubble_mask.9.png │ │ └── amu_bubble_shadow.9.png │ │ ├── drawable-xxxhdpi │ │ ├── amu_bubble_mask.9.png │ │ └── amu_bubble_shadow.9.png │ │ ├── drawable │ │ ├── amu_bubble_mask.9.png │ │ └── amu_bubble_shadow.9.png │ │ ├── layout │ │ ├── amu_info_window.xml │ │ ├── amu_text_bubble.xml │ │ └── amu_webview.xml │ │ └── values │ │ ├── ids.xml │ │ └── styles.xml │ └── test │ ├── java │ └── com │ │ └── google │ │ └── maps │ │ └── android │ │ ├── AnimationUtilTest.kt │ │ ├── PolyUtilTest.java │ │ ├── SphericalUtilTest.java │ │ ├── StreetViewUtilTest.kt │ │ ├── TestUtil.java │ │ ├── clustering │ │ ├── QuadItemTest.java │ │ ├── StaticClusterTest.java │ │ └── algo │ │ │ └── CentroidNonHierarchicalDistanceBasedAlgorithmTest.java │ │ ├── data │ │ ├── FeatureTest.java │ │ ├── LineStringTest.java │ │ ├── MultiGeometryTest.java │ │ ├── PointTest.java │ │ ├── RendererTest.java │ │ ├── geojson │ │ │ ├── BiMultiMapTest.java │ │ │ ├── GeoJsonFeatureTest.java │ │ │ ├── GeoJsonLayerTest.java │ │ │ ├── GeoJsonLineStringStyleTest.java │ │ │ ├── GeoJsonLineStringTest.java │ │ │ ├── GeoJsonMultiLineStringTest.java │ │ │ ├── GeoJsonMultiPointTest.java │ │ │ ├── GeoJsonMultiPolygonTest.java │ │ │ ├── GeoJsonParserTest.java │ │ │ ├── GeoJsonPointStyleTest.java │ │ │ ├── GeoJsonPointTest.java │ │ │ ├── GeoJsonPolygonStyleTest.java │ │ │ ├── GeoJsonPolygonTest.java │ │ │ ├── GeoJsonRendererTest.java │ │ │ └── GeoJsonTestUtil.java │ │ └── kml │ │ │ ├── KmlContainerParserTest.java │ │ │ ├── KmlFeatureParserTest.java │ │ │ ├── KmlLineStringTest.java │ │ │ ├── KmlMultiGeometryTest.java │ │ │ ├── KmlMultiTrackTest.java │ │ │ ├── KmlParserTest.java │ │ │ ├── KmlPointTest.java │ │ │ ├── KmlPolygonTest.java │ │ │ ├── KmlRendererTest.java │ │ │ ├── KmlStyleTest.java │ │ │ ├── KmlTestUtil.java │ │ │ ├── KmlTrackTest.java │ │ │ └── KmlUtilTest.java │ │ ├── heatmaps │ │ ├── GradientTest.java │ │ └── UtilTest.java │ │ └── quadtree │ │ └── PointQuadTreeTest.java │ └── resources │ ├── amu_ballon_gx_prefix.kml │ ├── amu_basic_folder.kml │ ├── amu_basic_placemark.kml │ ├── amu_cdata.kml │ ├── amu_default_balloon.kml │ ├── amu_document_nest.kml │ ├── amu_draw_order_ground_overlay.kml │ ├── amu_empty_hotspot.kml │ ├── amu_extended_data.kml │ ├── amu_ground_overlay.kml │ ├── amu_ground_overlay_color.kml │ ├── amu_inline_style.kml │ ├── amu_multigeometry_placemarks.kml │ ├── amu_multiple_placemarks.kml │ ├── amu_nested_folders.kml │ ├── amu_nested_multigeometry.kml │ ├── amu_poly_style_boolean_alpha.kml │ ├── amu_poly_style_boolean_numeric.kml │ ├── amu_unknown_folder.kml │ ├── amu_unsupported.kml │ ├── amu_visibility_ground_overlay.kml │ ├── amu_wrong_not_exist_coordinates.kml │ ├── amu_wrong_not_exist_latitude_coordinates.kml │ └── robolectric.properties ├── lint-checks ├── .gitignore ├── build.gradle └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── maps │ │ │ └── android │ │ │ └── lint │ │ │ └── checks │ │ │ ├── GoogleMapDetector.kt │ │ │ └── MapsUtilsIssueRegistry.kt │ └── resources │ │ └── META-INF.services │ │ └── com.android.tools.lint.client.api.IssueRegistry │ └── test │ └── java │ └── com │ └── google │ └── maps │ └── android │ └── lint │ └── checks │ └── GoogleMapDetectorTest.kt ├── local.defaults.properties ├── release.gpg.gpg ├── settings.gradle.kts └── tools └── android-wait-for-emulator.sh /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 16 | 17 | .github/ @googlemaps/googlemaps-admin 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: 'type: bug, triage me' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Thanks for stopping by to let us know something could be better! 11 | 12 | --- 13 | **PLEASE READ** 14 | 15 | If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/). This will ensure a timely response. 16 | 17 | Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform [support resources page](https://developers.google.com/maps/support/). 18 | 19 | If your bug or feature request is not related to this particular library, please visit the Google Maps Platform [issue trackers](https://developers.google.com/maps/support/#issue_tracker). 20 | 21 | Check for answers on StackOverflow with the [google-maps](http://stackoverflow.com/questions/tagged/google-maps) tag. 22 | 23 | --- 24 | 25 | Please be sure to include as much information as possible: 26 | 27 | #### Summary 28 | 29 | Summarize your issue in one or two sentences 30 | 31 | #### Expected behavior 32 | 33 | What did you expect? 34 | 35 | #### Observed behavior 36 | 37 | What did you see instead? Describe your issue in detail here. 38 | 39 | #### Environment details 40 | 41 | 1. Device make and model, or emulator details 42 | 2. Android version 43 | 3. Library version and other environment information 44 | 45 | #### Steps to reproduce 46 | 47 | If you can reproduce using the demo app in the project, it helps us troubleshoot faster. 48 | 49 | 1. ? 50 | 51 | #### Code example 52 | 53 | ``` 54 | # example 55 | ``` 56 | 57 | #### Stack trace 58 | ``` 59 | # example 60 | ``` 61 | 62 | Following these steps will guarantee the quickest resolution possible. 63 | 64 | Thanks! 65 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this library 4 | title: '' 5 | labels: 'type: feature request, triage me' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Thanks for stopping by to let us know something could be better! 11 | 12 | --- 13 | **PLEASE READ** 14 | 15 | If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/). This will ensure a timely response. 16 | 17 | Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform [support resources page](https://developers.google.com/maps/support/). 18 | 19 | If your bug or feature request is not related to this particular library, please visit the Google Maps Platform [issue trackers](https://developers.google.com/maps/support/#issue_tracker). 20 | 21 | Check for answers on StackOverflow with the [google-maps](http://stackoverflow.com/questions/tagged/google-maps) tag. 22 | 23 | --- 24 | 25 | **Is your feature request related to a problem? Please describe.** 26 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 27 | 28 | **Describe the solution you'd like** 29 | A clear and concise description of what you want to happen. 30 | 31 | **Describe alternatives you've considered** 32 | A clear and concise description of any alternative solutions or features you've considered. 33 | 34 | **Additional context** 35 | Add any other context or screenshots about the feature request here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support request 3 | about: If you have a support contract with Google, please create an issue in the Google 4 | Cloud Support console. 5 | title: '' 6 | labels: 'triage me, type: question' 7 | assignees: '' 8 | 9 | --- 10 | 11 | **PLEASE READ** 12 | 13 | If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/). This will ensure a timely response. 14 | 15 | Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform [support resources page](https://developers.google.com/maps/support/). 16 | 17 | If your bug or feature request is not related to this particular library, please visit the Google Maps Platform [issue trackers](https://developers.google.com/maps/support/#issue_tracker). 18 | 19 | Check for answers on StackOverflow with the [google-maps](http://stackoverflow.com/questions/tagged/google-maps) tag. 20 | 21 | --- 22 | -------------------------------------------------------------------------------- /.github/blunderbuss.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | assign_issues: [] 16 | assign_prs: 17 | - dkhawk 18 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # To get started with Dependabot version updates, you'll need to specify which 16 | # package ecosystems to update and where the package manifests are located. 17 | # Please see the documentation for all configuration options: 18 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 19 | 20 | version: 2 21 | updates: 22 | - package-ecosystem: "gradle" # See documentation for possible values 23 | directory: "/" # Location of package manifests 24 | schedule: 25 | interval: "weekly" 26 | - package-ecosystem: "github-actions" 27 | directory: "/" # Location of package manifests 28 | schedule: 29 | interval: "weekly" -------------------------------------------------------------------------------- /.github/header-checker-lint.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Presubmit test that ensures that source files contain valid license headers 16 | # https://github.com/googleapis/repo-automation-bots/tree/main/packages/header-checker-lint 17 | # Install: https://github.com/apps/license-header-lint-gcf 18 | 19 | allowedCopyrightHolders: 20 | - 'Google LLC' 21 | allowedLicenses: 22 | - 'Apache-2.0' 23 | sourceFileExtensions: 24 | - 'yaml' 25 | - 'yml' 26 | - 'sh' 27 | - 'ts' 28 | - 'js' 29 | - 'java' 30 | - 'html' 31 | - 'txt' 32 | - 'kt' 33 | - 'kts' 34 | - 'xml' 35 | - 'gradle' 36 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Thank you for opening a Pull Request! 2 | 3 | --- 4 | 5 | Before submitting your PR, there are a few things you can do to make sure it goes smoothly: 6 | - [ ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea 7 | - [ ] Edit the title of this pull request with a [semantic commit prefix](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#type) (e.g. "fix: "), which is necessary for automated release workflows to decide whether to generate a new release and what type it should be. 8 | - [ ] Will this cause breaking changes to existing Java or Kotlin integrations? If so, ensure the commit has a `BREAKING CHANGE` footer so when this change is integrated a major version update is triggered. See: https://www.conventionalcommits.org/en/v1.0.0/ 9 | - [ ] Ensure the tests and linter pass 10 | - [ ] Code coverage does not decrease (if any source code was changed) 11 | - [ ] Appropriate docs were updated (if necessary) 12 | 13 | Fixes # 🦕 14 | -------------------------------------------------------------------------------- /.github/sync-repo-settings.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings 16 | 17 | rebaseMergeAllowed: true 18 | squashMergeAllowed: true 19 | mergeCommitAllowed: false 20 | deleteBranchOnMerge: true 21 | branchProtectionRules: 22 | - pattern: main 23 | isAdminEnforced: false 24 | requiresStrictStatusChecks: false 25 | requiredStatusCheckContexts: 26 | - 'cla/google' 27 | - 'test' 28 | - 'snippet-bot check' 29 | - 'header-check' 30 | requiredApprovingReviewCount: 1 31 | requiresCodeOwnerReviews: true 32 | - pattern: master 33 | isAdminEnforced: false 34 | requiresStrictStatusChecks: false 35 | requiredStatusCheckContexts: 36 | - 'cla/google' 37 | - 'test' 38 | - 'snippet-bot check' 39 | - 'header-check' 40 | requiredApprovingReviewCount: 1 41 | requiresCodeOwnerReviews: true 42 | permissionRules: 43 | - team: admin 44 | permission: admin 45 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # A workflow that updates the gh-pages branch whenever a new release is made 16 | name: Update documentation 17 | 18 | on: 19 | push: 20 | branches: [ main ] 21 | repository_dispatch: 22 | types: [gh-pages] 23 | workflow_dispatch: 24 | 25 | jobs: 26 | gh-page-sync: 27 | runs-on: ubuntu-latest 28 | 29 | steps: 30 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 31 | - name: Checkout Repo 32 | uses: actions/checkout@v4 33 | 34 | - name: Gradle Wrapper Validation 35 | uses: gradle/actions/wrapper-validation@v4 36 | 37 | - name: Set up JDK 17 38 | uses: actions/setup-java@v4.2.1 39 | with: 40 | java-version: '17' 41 | distribution: 'temurin' 42 | - name: Install Go 43 | uses: actions/setup-go@v5 44 | with: 45 | go-version: '1.20' 46 | 47 | # Run dokka and create tar 48 | - name: Generate documentation 49 | run: | 50 | ./gradlew dokkaHtml 51 | 52 | echo "Creating tar for generated docs" 53 | cd $GITHUB_WORKSPACE/library/build/dokka/html && tar cvf ~/android-maps-utils-docs.tar . 54 | 55 | echo "Unpacking tar into gh-pages branch" 56 | git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* 57 | go install github.com/google/addlicense@latest 58 | addlicense . 59 | cd $GITHUB_WORKSPACE && git checkout gh-pages && tar xvf ~/android-maps-utils-docs.tar 60 | 61 | # Commit changes and create a PR 62 | - name: PR Changes 63 | uses: peter-evans/create-pull-request@v7 64 | with: 65 | token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} 66 | commit-message: 'docs: Update docs' 67 | author: googlemaps-bot 68 | committer: googlemaps-bot 69 | labels: | 70 | docs 71 | automerge 72 | title: 'docs: Update docs' 73 | body: | 74 | Updated GitHub pages with latest from `./gradlew dokkaHtml`. 75 | branch: googlemaps-bot/update_gh_pages 76 | -------------------------------------------------------------------------------- /.github/workflows/lint-report.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Lint and Upload SARIF 16 | 17 | on: 18 | pull_request: 19 | branches: 20 | - main 21 | 22 | jobs: 23 | lint: 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | - name: Checkout code 28 | uses: actions/checkout@v4 29 | 30 | - name: Set up JDK 17 31 | uses: actions/setup-java@v3 32 | with: 33 | distribution: 'adopt' 34 | java-version: '17' 35 | 36 | - name: Run Android Lint 37 | run: ./gradlew lint 38 | 39 | - name: Merge SARIF files 40 | run: | 41 | jq -s '{ "$schema": "https://json.schemastore.org/sarif-2.1.0", "version": "2.1.0", "runs": map(.runs) | add }' library/build/reports/lint-results-debug.sarif demo/build/reports/lint-results-debug.sarif > merged.sarif 42 | 43 | - name: Upload SARIF file 44 | uses: github/codeql-action/upload-sarif@v3 45 | with: 46 | sarif_file: merged.sarif 47 | -------------------------------------------------------------------------------- /.github/workflows/report.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # A workflow that runs tests on every new pull request 16 | name: Run unit tests 17 | 18 | on: 19 | repository_dispatch: 20 | types: [test] 21 | push: 22 | branches-ignore: ['gh-pages'] 23 | pull_request: 24 | branches-ignore: ['gh-pages'] 25 | workflow_dispatch: 26 | workflow_call: 27 | 28 | jobs: 29 | test: 30 | runs-on: ubuntu-latest 31 | permissions: 32 | pull-requests: write 33 | steps: 34 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 35 | - name: Checkout Repo 36 | uses: actions/checkout@v4 37 | 38 | - name: Gradle Wrapper Validation 39 | uses: gradle/actions/wrapper-validation@v4 40 | 41 | - name: Set up JDK 17 42 | uses: actions/setup-java@v4.2.1 43 | with: 44 | java-version: '17' 45 | distribution: 'temurin' 46 | 47 | - name: Build modules 48 | run: ./gradlew build jacocoTestDebugUnitTestReport --stacktrace 49 | 50 | - name: Jacoco Report to PR 51 | id: jacoco 52 | uses: madrapps/jacoco-report@v1.7.1 53 | with: 54 | paths: | 55 | ${{ github.workspace }}/library/build/jacoco/jacoco.xml 56 | token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} 57 | min-coverage-overall: 26 58 | min-coverage-changed-files: 60 59 | title: Code Coverage 60 | debug-mode: false 61 | update-comment: true -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # A workflow that runs tests on every new pull request 16 | name: Run unit tests 17 | 18 | on: 19 | repository_dispatch: 20 | types: [test] 21 | push: 22 | branches-ignore: ['gh-pages'] 23 | pull_request: 24 | branches-ignore: ['gh-pages'] 25 | workflow_dispatch: 26 | workflow_call: 27 | 28 | jobs: 29 | test: 30 | runs-on: ubuntu-latest 31 | permissions: 32 | pull-requests: write 33 | steps: 34 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 35 | - name: Checkout Repo 36 | uses: actions/checkout@v4 37 | 38 | - name: Gradle Wrapper Validation 39 | uses: gradle/actions/wrapper-validation@v4 40 | 41 | - name: Set up JDK 17 42 | uses: actions/setup-java@v4.2.1 43 | with: 44 | java-version: '17' 45 | distribution: 'temurin' 46 | 47 | - name: Build modules 48 | run: ./gradlew build jacocoTestDebugUnitTestReport --stacktrace -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .idea 3 | *.iml 4 | build 5 | local.properties 6 | .classpath 7 | .project 8 | library/bin 9 | library/gen 10 | project.properties 11 | .DS_Store 12 | .java-version 13 | secrets.properties 14 | .kotlin -------------------------------------------------------------------------------- /.releaserc: -------------------------------------------------------------------------------- 1 | branches: 2 | - main 3 | - devsite 4 | plugins: 5 | - "@semantic-release/commit-analyzer" 6 | - "@semantic-release/release-notes-generator" 7 | - - "@google/semantic-release-replace-plugin" 8 | - replacements: 9 | - files: 10 | - "build.gradle.kts" 11 | from: "\\bversion = \".*\"" 12 | to: "version = \"${nextRelease.version}\"" 13 | - files: 14 | - "build.gradle.kts" 15 | from: "com.google.maps.android:android-maps-utils:([0-9]+).([0-9]+).([0-9]+)" 16 | to: "com.google.maps.android:android-maps-utils:${nextRelease.version}'" 17 | - files: 18 | - "README.md" 19 | from: ":([0-9]+).([0-9]+).([0-9]+)" 20 | to: ":${nextRelease.version}" 21 | - - "@semantic-release/exec" 22 | - prepareCmd: "./gradlew build --warn --stacktrace" 23 | publishCmd: "./gradlew publish --warn --stacktrace --debug --info" 24 | - - "@semantic-release/git" 25 | - assets: 26 | - "build.gradle.kts" 27 | - "*.md" 28 | - "@semantic-release/github" 29 | options: 30 | debug: true 31 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution; 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult 22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 23 | information on using pull requests. 24 | 25 | ## Community Guidelines 26 | 27 | This project follows 28 | [Google's Open Source Community Guidelines](https://opensource.google/conduct/). 29 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | * Chris Broadfoot, https://github.com/broady 4 | * Colin Edwards, https://github.com/DDRBoxman 5 | * Michael Evans, https://github.com/MichaelEvans 6 | * Maciej Gorski, https://github.com/mg6maciej 7 | * Claus Höfele, https://github.com/choefele 8 | * Cyril Mottier, https://github.com/cyrilmottier 9 | * Mihai Preda, https://github.com/preda 10 | * Iris Uy, https://github.com/irisu 11 | * Emma Yeap, https://github.com/microcat 12 | * Stefanos Togoulidis, https://github.com/hypest 13 | * Sean Barbeau, https://github.com/barbeau 14 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | Releasing 2 | ========= 3 | 4 | Releasing a new build to maven central is semi-automated by the [release] GitHub workflow which uses the [semantic-release] workflow. 5 | 6 | 1. When a new commit lands on the `main` branch, depending on the commit message, the semantic version number 7 | of the artifacts will be updated (see [semantic-release] for what kind of commit messages trigger a version bump). 8 | 2. Upon updating the version number, a git tag and GitHub release with a changelog is generated. 9 | 3. Once the new tag is pushed, the [publish] workflow gets triggered which upon succeeding uploads the new artifacts to the Sonatype staging repository. 10 | 4. Lastly, the staged artifacts require manual promotion in the Nexus Repository Manager to publish the builds to maven central. 11 | 12 | [release]: .github/workflows/release.yml 13 | [publish]: .github/workflows/publish.yml 14 | [semantic-release]: https://github.com/semantic-release/semantic-release 15 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Report a security issue 2 | 3 | To report a security issue, please use https://g.co/vulnz. We use 4 | https://g.co/vulnz for our intake, and do coordination and disclosure here on 5 | GitHub (including using GitHub Security Advisory). The Google Security Team will 6 | respond within 5 working days of your report on g.co/vulnz. 7 | 8 | To contact us about other bugs, please open an issue on GitHub. 9 | 10 | > **Note**: This file is synchronized from the https://github.com/googlemaps/.github repository. 11 | -------------------------------------------------------------------------------- /build-logic/.gitignore: -------------------------------------------------------------------------------- 1 | */build 2 | .gradle -------------------------------------------------------------------------------- /build-logic/convention/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | `kotlin-dsl` 19 | } 20 | 21 | repositories { 22 | google() 23 | mavenCentral() 24 | gradlePluginPortal() 25 | } 26 | 27 | 28 | dependencies { 29 | implementation(libs.kotlin.gradle.plugin) 30 | implementation(libs.gradle) 31 | implementation(libs.dokka.gradle.plugin) 32 | implementation(libs.org.jacoco.core) 33 | } 34 | 35 | gradlePlugin { 36 | plugins { 37 | register("publishingConventionPlugin") { 38 | id = "android.maps.utils.PublishingConventionPlugin" 39 | implementationClass = "PublishingConventionPlugin" 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /build-logic/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | dependencyResolutionManagement { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | versionCatalogs { 23 | create("libs") { 24 | from(files("../gradle/libs.versions.toml")) 25 | } 26 | } 27 | } 28 | 29 | rootProject.name = "build-logic" 30 | include(":convention") 31 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | buildscript { 18 | val kotlinVersion by extra(libs.versions.kotlin.get()) 19 | 20 | repositories { 21 | google() 22 | mavenCentral() 23 | } 24 | 25 | dependencies { 26 | classpath(libs.gradle) 27 | classpath(libs.jacoco.android) 28 | classpath(libs.secrets.gradle.plugin) 29 | classpath(libs.kotlin.gradle.plugin) 30 | classpath(libs.dokka.gradle.plugin) 31 | } 32 | } 33 | 34 | tasks.register("clean") { 35 | delete(rootProject.buildDir) 36 | } 37 | 38 | allprojects { 39 | group = "com.google.maps.android" 40 | version = "3.14.0" 41 | } -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | secure.properties 3 | -------------------------------------------------------------------------------- /demo/V3_FILE_HEADER: -------------------------------------------------------------------------------- 1 | /** 2 | * DO NOT EDIT THIS FILE. 3 | * 4 | * This source code was autogenerated from source code within the `demo/src/gms` directory 5 | * and is not intended for modifications. If any edits should be made, please do so in the 6 | * corresponding file under the `demo/src/gms` directory. 7 | */ 8 | -------------------------------------------------------------------------------- /demo/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id("com.android.application") 19 | id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") 20 | id("kotlin-android") 21 | } 22 | 23 | android { 24 | lint { 25 | sarifOutput = file("$buildDir/reports/lint-results.sarif") 26 | } 27 | 28 | defaultConfig { 29 | compileSdk = 35 30 | applicationId = "com.google.maps.android.utils.demo" 31 | minSdk = 21 32 | targetSdk = 35 33 | versionCode = 1 34 | versionName = "1.0" 35 | } 36 | 37 | buildTypes { 38 | release { 39 | isMinifyEnabled = true 40 | proguardFiles( 41 | getDefaultProguardFile("proguard-android-optimize.txt"), 42 | "proguard-rules.pro" 43 | ) 44 | } 45 | } 46 | 47 | kotlinOptions { 48 | jvmTarget = "17" 49 | } 50 | kotlin { 51 | jvmToolchain(17) 52 | } 53 | namespace = "com.google.maps.android.utils.demo" 54 | } 55 | 56 | // [START maps_android_utils_install_snippet] 57 | dependencies { 58 | // [START_EXCLUDE silent] 59 | implementation(project(":library")) 60 | 61 | implementation(libs.appcompat) 62 | implementation(libs.lifecycle.extensions) 63 | implementation(libs.lifecycle.viewmodel.ktx) 64 | implementation(libs.kotlin.stdlib.jdk8) 65 | implementation(libs.kotlinx.coroutines.android) 66 | implementation(libs.kotlinx.coroutines.core) 67 | implementation(libs.material) 68 | 69 | testImplementation(libs.junit) 70 | testImplementation(libs.truth) 71 | // [END_EXCLUDE] 72 | } 73 | // [END maps_android_utils_install_snippet] 74 | 75 | secrets { 76 | // To add your Maps API key to this project: 77 | // 1. Create a file ./secrets.properties 78 | // 2. Add this line, where YOUR_API_KEY is your API key: 79 | // MAPS_API_KEY=YOUR_API_KEY 80 | defaultPropertiesFileName ="local.defaults.properties" 81 | propertiesFileName = "secrets.properties" 82 | } 83 | -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | # Needed to avoid crash on minified app release with Maps SDK v3.1 beta (https://issuetracker.google.com/issues/148084488) 24 | -keep,allowoptimization class com.google.android.libraries.maps.** { *; } -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/AnimationUtilDemoActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo; 18 | 19 | import com.google.android.gms.maps.CameraUpdateFactory; 20 | import com.google.android.gms.maps.GoogleMap; 21 | import com.google.android.gms.maps.model.LatLng; 22 | import com.google.android.gms.maps.model.Marker; 23 | import com.google.android.gms.maps.model.MarkerOptions; 24 | import com.google.maps.android.ui.AnimationUtil; 25 | 26 | import androidx.annotation.NonNull; 27 | 28 | /** 29 | * Simple activity demonstrating the AnimationUtil. 30 | */ 31 | public class AnimationUtilDemoActivity extends BaseDemoActivity implements GoogleMap.OnMarkerClickListener { 32 | 33 | LatLng sydney = new LatLng(-33.852, 151.211); 34 | Marker currentMarker; 35 | 36 | @Override 37 | protected void startDemo(boolean isRestore) { 38 | getMap().setOnMarkerClickListener(this); 39 | 40 | // Add a marker in Sydney, Australia, 41 | // and move the map's camera to the same location. 42 | currentMarker = getMap().addMarker(new MarkerOptions() 43 | .position(sydney) 44 | .title("Marker in Sydney")); 45 | getMap().moveCamera(CameraUpdateFactory.newLatLng(sydney)); 46 | } 47 | 48 | public double getRandomNumber(int min, int max) { 49 | return ((Math.random() * (max - min)) + min); 50 | } 51 | 52 | @Override 53 | public boolean onMarkerClick(@NonNull Marker marker) { 54 | LatLng newRandomLat = new LatLng(getRandomNumber(-34, -33), getRandomNumber(150, 151)); 55 | AnimationUtil.animateMarkerTo(currentMarker, newRandomLat); 56 | return false; 57 | } 58 | } -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/ApiKeyValidator.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo 18 | 19 | import android.content.Context 20 | import android.content.pm.PackageManager 21 | import java.util.regex.Pattern 22 | 23 | /** 24 | * Checks if the provided context has a valid Google Maps API key in its metadata. 25 | * 26 | * 27 | * This method retrieves the API key from the application's metadata and returns whether or 28 | * not it has a valid format. 29 | * 30 | * @param context The context to check for the API key. 31 | * @return `true` if the context has a valid API key, `false` otherwise. 32 | */ 33 | fun hasMapsApiKey(context: Context): Boolean { 34 | val mapsApiKey = getMapsApiKey(context) 35 | 36 | return mapsApiKey != null && keyHasValidFormat(mapsApiKey) 37 | } 38 | 39 | /** 40 | * Checks if the provided API key has a valid format. 41 | * 42 | * 43 | * The valid format is defined by the regular expression "^AIza[0-9A-Za-z\\-_]{35}$". 44 | * 45 | * @param apiKey The API key to validate. 46 | * @return `true` if the API key has a valid format, `false` otherwise. 47 | */ 48 | internal fun keyHasValidFormat(apiKey: String): Boolean { 49 | val regex = "^AIza[0-9A-Za-z\\-_]{35}$" 50 | val pattern = Pattern.compile(regex) 51 | val matcher = pattern.matcher(apiKey) 52 | return matcher.matches() 53 | } 54 | 55 | /** 56 | * Retrieves the Google Maps API key from the application metadata. 57 | * 58 | * @param context The context to retrieve the API key from. 59 | * @return The API key if found, `null` otherwise. 60 | */ 61 | private fun getMapsApiKey(context: Context): String? { 62 | try { 63 | val bundle = context.packageManager 64 | .getApplicationInfo(context.packageName, PackageManager.GET_META_DATA) 65 | .metaData 66 | return bundle.getString("com.google.android.geo.API_KEY") 67 | } catch (e: PackageManager.NameNotFoundException) { 68 | e.printStackTrace() 69 | return null 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/BaseDemoActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo; 18 | 19 | import static com.google.maps.android.utils.demo.ApiKeyValidatorKt.hasMapsApiKey; 20 | 21 | import android.os.Bundle; 22 | import android.widget.Toast; 23 | 24 | import androidx.annotation.NonNull; 25 | import androidx.fragment.app.FragmentActivity; 26 | 27 | import com.google.android.gms.maps.GoogleMap; 28 | import com.google.android.gms.maps.OnMapReadyCallback; 29 | import com.google.android.gms.maps.SupportMapFragment; 30 | 31 | public abstract class BaseDemoActivity extends FragmentActivity implements OnMapReadyCallback { 32 | private GoogleMap mMap; 33 | private boolean mIsRestore; 34 | 35 | protected int getLayoutId() { 36 | return R.layout.map; 37 | } 38 | 39 | @Override 40 | public void onCreate(Bundle savedInstanceState) { 41 | super.onCreate(savedInstanceState); 42 | 43 | if (!hasMapsApiKey(this)) { 44 | Toast.makeText(this, R.string.bad_maps_api_key, Toast.LENGTH_LONG).show(); 45 | finish(); 46 | } 47 | 48 | mIsRestore = savedInstanceState != null; 49 | setContentView(getLayoutId()); 50 | setUpMap(); 51 | } 52 | 53 | @Override 54 | public void onMapReady(@NonNull GoogleMap map) { 55 | if (mMap != null) { 56 | return; 57 | } 58 | mMap = map; 59 | startDemo(mIsRestore); 60 | } 61 | 62 | private void setUpMap() { 63 | ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMapAsync(this); 64 | } 65 | 66 | /** 67 | * Run the demo-specific code. 68 | */ 69 | protected abstract void startDemo(boolean isRestore); 70 | 71 | protected GoogleMap getMap() { 72 | return mMap; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/BigClusteringDemoActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo; 18 | 19 | import android.widget.Toast; 20 | 21 | import com.google.android.gms.maps.CameraUpdateFactory; 22 | import com.google.android.gms.maps.model.LatLng; 23 | import com.google.maps.android.clustering.ClusterManager; 24 | import com.google.maps.android.utils.demo.model.MyItem; 25 | 26 | import org.json.JSONException; 27 | 28 | import java.io.InputStream; 29 | import java.util.List; 30 | 31 | public class BigClusteringDemoActivity extends BaseDemoActivity { 32 | private ClusterManager mClusterManager; 33 | 34 | @Override 35 | protected void startDemo(boolean isRestore) { 36 | if (!isRestore) { 37 | getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10)); 38 | } 39 | 40 | mClusterManager = new ClusterManager<>(this, getMap()); 41 | 42 | getMap().setOnCameraIdleListener(mClusterManager); 43 | try { 44 | readItems(); 45 | } catch (JSONException e) { 46 | Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show(); 47 | } 48 | } 49 | 50 | private void readItems() throws JSONException { 51 | InputStream inputStream = getResources().openRawResource(R.raw.radar_search); 52 | List items = new MyItemReader().read(inputStream); 53 | for (int i = 0; i < 10; i++) { 54 | double offset = i / 60d; 55 | for (MyItem item : items) { 56 | LatLng position = item.getPosition(); 57 | double lat = position.latitude + offset; 58 | double lng = position.longitude + offset; 59 | MyItem offsetItem = new MyItem(lat, lng); 60 | mClusterManager.addItem(offsetItem); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/ClusteringViewModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo; 18 | 19 | import androidx.lifecycle.ViewModel; 20 | import android.content.res.Resources; 21 | 22 | import com.google.android.gms.maps.model.LatLng; 23 | import com.google.maps.android.clustering.algo.NonHierarchicalViewBasedAlgorithm; 24 | import com.google.maps.android.utils.demo.model.MyItem; 25 | 26 | import org.json.JSONException; 27 | 28 | import java.io.InputStream; 29 | import java.util.List; 30 | 31 | public class ClusteringViewModel extends ViewModel { 32 | 33 | private final NonHierarchicalViewBasedAlgorithm mAlgorithm = new NonHierarchicalViewBasedAlgorithm<>(0, 0); 34 | 35 | NonHierarchicalViewBasedAlgorithm getAlgorithm() { 36 | return mAlgorithm; 37 | } 38 | 39 | void readItems(Resources resources) throws JSONException { 40 | InputStream inputStream = resources.openRawResource(R.raw.radar_search); 41 | List items = new MyItemReader().read(inputStream); 42 | mAlgorithm.lock(); 43 | try { 44 | for (int i = 0; i < 100; i++) { 45 | double offset = i / 60d; 46 | for (MyItem item : items) { 47 | LatLng position = item.getPosition(); 48 | double lat = position.latitude + offset; 49 | double lng = position.longitude + offset; 50 | MyItem offsetItem = new MyItem(lat, lng); 51 | mAlgorithm.addItem(offsetItem); 52 | } 53 | } 54 | } finally { 55 | mAlgorithm.unlock(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/ClusteringViewModelDemoActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo; 18 | 19 | import androidx.lifecycle.ViewModelProviders; 20 | import android.os.Bundle; 21 | import android.util.DisplayMetrics; 22 | import android.widget.Toast; 23 | 24 | import com.google.android.gms.maps.CameraUpdateFactory; 25 | import com.google.android.gms.maps.model.LatLng; 26 | import com.google.maps.android.clustering.ClusterManager; 27 | import com.google.maps.android.utils.demo.model.MyItem; 28 | 29 | import org.json.JSONException; 30 | 31 | public class ClusteringViewModelDemoActivity extends BaseDemoActivity { 32 | private ClusteringViewModel mViewModel; 33 | 34 | @Override 35 | public void onCreate(Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | mViewModel = ViewModelProviders.of(this).get(ClusteringViewModel.class); 38 | if (savedInstanceState == null) { 39 | try { 40 | mViewModel.readItems(getResources()); 41 | } catch (JSONException e) { 42 | Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show(); 43 | } 44 | } 45 | } 46 | 47 | @Override 48 | protected void startDemo(boolean isRestore) { 49 | if (!isRestore) { 50 | getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10)); 51 | } 52 | 53 | DisplayMetrics metrics = new DisplayMetrics(); 54 | getWindowManager().getDefaultDisplay().getMetrics(metrics); 55 | 56 | int widthDp = (int) (metrics.widthPixels / metrics.density); 57 | int heightDp = (int) (metrics.heightPixels / metrics.density); 58 | 59 | mViewModel.getAlgorithm().updateViewSize(widthDp, heightDp); 60 | 61 | ClusterManager mClusterManager = new ClusterManager<>(this, getMap()); 62 | mClusterManager.setAlgorithm(mViewModel.getAlgorithm()); 63 | 64 | getMap().setOnCameraIdleListener(mClusterManager); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/MyItemReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo; 18 | 19 | import com.google.maps.android.utils.demo.model.MyItem; 20 | 21 | import org.json.JSONArray; 22 | import org.json.JSONException; 23 | import org.json.JSONObject; 24 | 25 | import java.io.InputStream; 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | import java.util.Scanner; 29 | 30 | public class MyItemReader { 31 | 32 | /* 33 | * This matches only once in whole input, 34 | * so Scanner.next returns whole InputStream as a String. 35 | * http://stackoverflow.com/a/5445161/2183804 36 | */ 37 | private static final String REGEX_INPUT_BOUNDARY_BEGINNING = "\\A"; 38 | 39 | public List read(InputStream inputStream) throws JSONException { 40 | List items = new ArrayList(); 41 | String json = new Scanner(inputStream).useDelimiter(REGEX_INPUT_BOUNDARY_BEGINNING).next(); 42 | JSONArray array = new JSONArray(json); 43 | for (int i = 0; i < array.length(); i++) { 44 | String title = null; 45 | String snippet = null; 46 | JSONObject object = array.getJSONObject(i); 47 | double lat = object.getDouble("lat"); 48 | double lng = object.getDouble("lng"); 49 | if (!object.isNull("title")) { 50 | title = object.getString("title"); 51 | } 52 | if (!object.isNull("snippet")) { 53 | snippet = object.getString("snippet"); 54 | } 55 | items.add(new MyItem(lat, lng, title, snippet)); 56 | } 57 | return items; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/PolyDecodeDemoActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo; 18 | 19 | import com.google.android.gms.maps.CameraUpdateFactory; 20 | import com.google.android.gms.maps.model.LatLng; 21 | import com.google.android.gms.maps.model.PolylineOptions; 22 | import com.google.maps.android.PolyUtil; 23 | 24 | import java.util.List; 25 | 26 | public class PolyDecodeDemoActivity extends BaseDemoActivity { 27 | 28 | private final static String LINE = "rvumEis{y[}DUaBGu@EqESyCMyAGGZGdEEhBAb@DZBXCPGP]Xg@LSBy@E{@SiBi@wAYa@AQGcAY]I]KeBm@_Bw@cBu@ICKB}KiGsEkCeEmBqJcFkFuCsFuCgB_AkAi@cA[qAWuAKeB?uALgB\\eDx@oBb@eAVeAd@cEdAaCp@s@PO@MBuEpA{@R{@NaAHwADuBAqAGE?qCS[@gAO{Fg@qIcAsCg@u@SeBk@aA_@uCsAkBcAsAy@AMGIw@e@_Bq@eA[eCi@QOAK@O@YF}CA_@Ga@c@cAg@eACW@YVgDD]Nq@j@}AR{@rBcHvBwHvAuFJk@B_@AgAGk@UkAkBcH{@qCuAiEa@gAa@w@c@o@mA{Ae@s@[m@_AaCy@uB_@kAq@_Be@}@c@m@{AwAkDuDyC_De@w@{@kB_A}BQo@UsBGy@AaA@cLBkCHsBNoD@c@E]q@eAiBcDwDoGYY_@QWEwE_@i@E}@@{BNaA@s@EyB_@c@?a@F}B\\iCv@uDjAa@Ds@Bs@EyAWo@Sm@a@YSu@c@g@Mi@GqBUi@MUMMMq@}@SWWM]C[DUJONg@hAW\\QHo@BYIOKcG{FqCsBgByAaAa@gA]c@I{@Gi@@cALcEv@_G|@gAJwAAUGUAk@C{Ga@gACu@A[Em@Sg@Y_AmA[u@Oo@qAmGeAeEs@sCgAqDg@{@[_@m@e@y@a@YIKCuAYuAQyAUuAWUaA_@wBiBgJaAoFyCwNy@cFIm@Bg@?a@t@yIVuDx@qKfA}N^aE@yE@qAIeDYaFBW\\eBFkANkANWd@gALc@PwAZiBb@qCFgCDcCGkCKoC`@gExBaVViDH}@kAOwAWe@Cg@BUDBU`@sERcCJ{BzFeB"; 29 | 30 | @Override 31 | protected void startDemo(boolean isRestore) { 32 | List decodedPath = PolyUtil.decode(LINE); 33 | 34 | getMap().addPolyline(new PolylineOptions().addAll(decodedPath)); 35 | 36 | if (!isRestore) { 37 | getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8256, 151.2395), 12)); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/StreetViewDemoActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo 18 | 19 | import android.annotation.SuppressLint 20 | import android.app.Activity 21 | import android.os.Bundle 22 | import android.widget.TextView 23 | import android.widget.Toast 24 | import com.google.android.gms.maps.model.LatLng 25 | import com.google.maps.android.StreetViewUtils 26 | import kotlinx.coroutines.DelicateCoroutinesApi 27 | import kotlinx.coroutines.Dispatchers 28 | import kotlinx.coroutines.GlobalScope 29 | import kotlinx.coroutines.launch 30 | 31 | class StreetViewDemoActivity : Activity() { 32 | 33 | @SuppressLint("SetTextI18n") 34 | @OptIn(DelicateCoroutinesApi::class) 35 | override fun onCreate(savedInstanceState: Bundle?) { 36 | super.onCreate(savedInstanceState) 37 | setContentView(R.layout.street_view_demo) 38 | 39 | if (!hasMapsApiKey(this)) { 40 | Toast.makeText(this, R.string.bad_maps_api_key, Toast.LENGTH_LONG).show() 41 | finish() 42 | } 43 | 44 | GlobalScope.launch(Dispatchers.Main) { 45 | val response1 = 46 | StreetViewUtils.fetchStreetViewData(LatLng(48.1425918, 11.5386121), BuildConfig.MAPS_API_KEY) 47 | val response2 = StreetViewUtils.fetchStreetViewData(LatLng(8.1425918, 11.5386121), BuildConfig.MAPS_API_KEY) 48 | 49 | findViewById(R.id.textViewFirstLocation).text = "Location 1 is supported in StreetView: $response1" 50 | findViewById(R.id.textViewSecondLocation).text = "Location 2 is supported in StreetView: $response2" 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/model/MyItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo.model; 18 | 19 | import com.google.android.gms.maps.model.LatLng; 20 | import com.google.maps.android.clustering.ClusterItem; 21 | 22 | import androidx.annotation.NonNull; 23 | 24 | public class MyItem implements ClusterItem { 25 | private final LatLng mPosition; 26 | private String mTitle; 27 | private String mSnippet; 28 | private Float zIndex; 29 | 30 | public MyItem(double lat, double lng) { 31 | mPosition = new LatLng(lat, lng); 32 | mTitle = null; 33 | mSnippet = null; 34 | } 35 | 36 | public MyItem(double lat, double lng, String title, String snippet) { 37 | mPosition = new LatLng(lat, lng); 38 | mTitle = title; 39 | mSnippet = snippet; 40 | } 41 | 42 | @NonNull 43 | @Override 44 | public LatLng getPosition() { 45 | return mPosition; 46 | } 47 | 48 | @Override 49 | public String getTitle() { return mTitle; } 50 | 51 | @Override 52 | public String getSnippet() { return mSnippet; } 53 | 54 | @Override 55 | public Float getZIndex() { 56 | return zIndex; 57 | } 58 | 59 | /** 60 | * Set the title of the marker 61 | * @param title string to be set as title 62 | */ 63 | public void setTitle(String title) { 64 | mTitle = title; 65 | } 66 | 67 | /** 68 | * Set the description of the marker 69 | * @param snippet string to be set as snippet 70 | */ 71 | public void setSnippet(String snippet) { 72 | mSnippet = snippet; 73 | } 74 | 75 | /** 76 | * Set the z-index of the marker 77 | * @param zIndex float to be set as z-index 78 | */ 79 | public void setZIndex(Float zIndex) { 80 | this.zIndex = zIndex; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /demo/src/main/java/com/google/maps/android/utils/demo/model/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.maps.android.utils.demo.model; 18 | 19 | import com.google.android.gms.maps.model.LatLng; 20 | import com.google.maps.android.clustering.ClusterItem; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | 25 | import java.util.Objects; 26 | 27 | 28 | public class Person implements ClusterItem { 29 | public final String name; 30 | public final int profilePhoto; 31 | private final LatLng mPosition; 32 | 33 | public Person(LatLng position, String name, int pictureResource) { 34 | this.name = name; 35 | profilePhoto = pictureResource; 36 | mPosition = position; 37 | } 38 | 39 | @NonNull 40 | @Override 41 | public LatLng getPosition() { 42 | return mPosition; 43 | } 44 | 45 | @Override 46 | public String getTitle() { 47 | return null; 48 | } 49 | 50 | @Override 51 | public String getSnippet() { 52 | return null; 53 | } 54 | 55 | @Nullable 56 | @Override 57 | public Float getZIndex() { 58 | return null; 59 | } 60 | 61 | @Override 62 | public int hashCode() { 63 | return Objects.hashCode(name); 64 | } 65 | 66 | // If we use the diff() operation, we need to implement an equals operation, to determine what 67 | // makes each ClusterItem unique (which is probably not the position) 68 | @Override 69 | public boolean equals(@Nullable Object obj) { 70 | if (obj != null && getClass() != obj.getClass()) return false; 71 | Person myObj = (Person) obj; 72 | return this.name.equals(myObj.name); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/gran.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/gran.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/john.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/john.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/mechanic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/mechanic.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/ruth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/ruth.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/stefan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/stefan.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/teacher.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/teacher.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/turtle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/turtle.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/walter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/walter.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable-nodpi/yeats.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps/android-maps-utils/3ba4f98b7d56034e5c318968d81c107389739b99/demo/src/main/res/drawable-nodpi/yeats.jpg -------------------------------------------------------------------------------- /demo/src/main/res/layout/custom_info_window.xml: -------------------------------------------------------------------------------- 1 | 16 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/distance_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 27 | 28 | 32 | 33 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/geojson_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/heatmaps_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 27 | 28 |