├── .github └── workflows │ └── build.yml ├── .gitignore ├── .idea ├── modules.xml └── workspace.xml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── app_screenshot.png ├── solution-ktx ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── codelabs │ │ │ └── buildyourfirstmap │ │ │ ├── BitmapHelper.kt │ │ │ ├── MainActivity.kt │ │ │ ├── MarkerInfoWindowAdapter.kt │ │ │ └── place │ │ │ ├── Place.kt │ │ │ ├── PlaceRenderer.kt │ │ │ ├── PlacesReader.kt │ │ │ └── PlacesResponse.kt │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_directions_bike_black_24dp.xml │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ └── marker_info_contents.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── raw │ │ └── places.json │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties.defaults └── settings.gradle ├── solution ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── codelabs │ │ │ └── buildyourfirstmap │ │ │ ├── BitmapHelper.kt │ │ │ ├── MainActivity.kt │ │ │ ├── MarkerInfoWindowAdapter.kt │ │ │ └── place │ │ │ ├── Place.kt │ │ │ ├── PlaceRenderer.kt │ │ │ ├── PlacesReader.kt │ │ │ └── PlacesResponse.kt │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_directions_bike_black_24dp.xml │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ └── marker_info_contents.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── raw │ │ └── places.json │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties.defaults └── settings.gradle └── starter ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── google │ │ └── codelabs │ │ └── buildyourfirstmap │ │ ├── BitmapHelper.kt │ │ ├── MainActivity.kt │ │ └── place │ │ ├── Place.kt │ │ ├── PlacesReader.kt │ │ └── PlacesResponse.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── ic_directions_bike_black_24dp.xml │ └── ic_launcher_background.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── raw │ └── places.json │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.github/workflows/build.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 | name: Build 16 | 17 | # Controls when the action will run. Triggers the workflow on push or pull request 18 | # events but only for the master branch 19 | on: 20 | push: 21 | branches: [ main ] 22 | pull_request: 23 | branches: [ main ] 24 | repository_dispatch: 25 | types: [ build ] 26 | schedule: 27 | - cron: '0 0 * * 1' 28 | 29 | jobs: 30 | build-starter: 31 | runs-on: ubuntu-latest 32 | timeout-minutes: 45 33 | env: 34 | TERM: dumb 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v2 39 | 40 | - name: set up JDK 1.8 41 | uses: actions/setup-java@v1 42 | with: 43 | java-version: 1.8 44 | 45 | - name: Build and check 46 | run: | 47 | cd starter 48 | ./gradlew assembleDebug app:lintDebug 49 | 50 | - name: Upload build reports 51 | if: always() 52 | uses: actions/upload-artifact@v1 53 | with: 54 | name: build-reports 55 | path: starter/app/build/reports 56 | 57 | build-solution: 58 | runs-on: ubuntu-latest 59 | timeout-minutes: 45 60 | env: 61 | TERM: dumb 62 | 63 | steps: 64 | - name: Checkout repository 65 | uses: actions/checkout@v2 66 | 67 | - name: set up JDK 1.8 68 | uses: actions/setup-java@v1 69 | with: 70 | java-version: 1.8 71 | 72 | - name: Build and check 73 | run: | 74 | cd solution 75 | ./gradlew assembleDebug app:lintDebug 76 | 77 | - name: Upload build reports 78 | if: always() 79 | uses: actions/upload-artifact@v1 80 | with: 81 | name: build-reports 82 | path: solution/app/build/reports 83 | 84 | build-solution-ktx: 85 | runs-on: ubuntu-latest 86 | timeout-minutes: 45 87 | env: 88 | TERM: dumb 89 | 90 | steps: 91 | - name: Checkout repository 92 | uses: actions/checkout@v2 93 | 94 | - name: set up JDK 1.8 95 | uses: actions/setup-java@v1 96 | with: 97 | java-version: 1.8 98 | 99 | - name: Build and check 100 | run: | 101 | cd solution-ktx 102 | ./gradlew assembleDebug app:lintDebug 103 | 104 | - name: Upload build reports 105 | if: always() 106 | uses: actions/upload-artifact@v1 107 | with: 108 | name: build-reports 109 | path: solution-ktx/app/build/reports 110 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | secrets.properties 2 | .DS_Store 3 | # Built application files 4 | *.apk 5 | *.aar 6 | *.ap_ 7 | *.aab 8 | 9 | # Files for the ART/Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | out/ 19 | # Uncomment the following line in case you need and you don't have the release build type files in your app 20 | # release/ 21 | 22 | # Gradle files 23 | .gradle/ 24 | build/ 25 | 26 | # Local configuration file (sdk path, etc) 27 | local.properties 28 | 29 | # Proguard folder generated by Eclipse 30 | proguard/ 31 | 32 | # Log Files 33 | *.log 34 | 35 | # Android Studio Navigation editor temp files 36 | .navigation/ 37 | 38 | # Android Studio captures folder 39 | captures/ 40 | 41 | # IntelliJ 42 | *.iml 43 | */.idea/* 44 | # Android Studio 3 in .gitignore file. 45 | */.idea/caches 46 | */.idea/modules.xml 47 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 48 | */.idea/navEditor.xml 49 | 50 | # Keystore files 51 | # Uncomment the following lines if you do not want to check your keystore files in. 52 | #*.jks 53 | #*.keystore 54 | 55 | # External native build folder generated in Android Studio 2.2 and later 56 | .externalNativeBuild 57 | .cxx/ 58 | 59 | # Google Services (e.g. APIs or Firebase) 60 | # google-services.json 61 | 62 | # Freeline 63 | freeline.py 64 | freeline/ 65 | freeline_project_description.json 66 | 67 | # fastlane 68 | fastlane/report.xml 69 | fastlane/Preview.html 70 | fastlane/screenshots 71 | fastlane/test_output 72 | fastlane/readme.md 73 | 74 | # Version control 75 | vcs.xml 76 | 77 | # lint 78 | lint/intermediates/ 79 | lint/generated/ 80 | lint/outputs/ 81 | lint/tmp/ 82 | # lint/reports/ 83 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 19 | 20 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 1624395332581 41 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Google Open Source Community Guidelines 2 | 3 | At Google, we recognize and celebrate the creativity and collaboration of open 4 | source contributors and the diversity of skills, experiences, cultures, and 5 | opinions they bring to the projects and communities they participate in. 6 | 7 | Every one of Google's open source projects and communities are inclusive 8 | environments, based on treating all individuals respectfully, regardless of 9 | gender identity and expression, sexual orientation, disabilities, 10 | neurodiversity, physical appearance, body size, ethnicity, nationality, race, 11 | age, religion, or similar personal characteristic. 12 | 13 | We value diverse opinions, but we value respectful behavior more. 14 | 15 | Respectful behavior includes: 16 | 17 | * Being considerate, kind, constructive, and helpful. 18 | * Not engaging in demeaning, discriminatory, harassing, hateful, sexualized, or 19 | physically threatening behavior, speech, and imagery. 20 | * Not engaging in unwanted physical contact. 21 | 22 | Some Google open source projects [may adopt][] an explicit project code of 23 | conduct, which may have additional detailed expectations for participants. Most 24 | of those projects will use our [modified Contributor Covenant][]. 25 | 26 | [may adopt]: https://opensource.google/docs/releasing/preparing/#conduct 27 | [modified Contributor Covenant]: https://opensource.google/docs/releasing/template/CODE_OF_CONDUCT/ 28 | 29 | ## Resolve peacefully 30 | 31 | We do not believe that all conflict is necessarily bad; healthy debate and 32 | disagreement often yields positive results. However, it is never okay to be 33 | disrespectful. 34 | 35 | If you see someone behaving disrespectfully, you are encouraged to address the 36 | behavior directly with those involved. Many issues can be resolved quickly and 37 | easily, and this gives people more control over the outcome of their dispute. 38 | If you are unable to resolve the matter for any reason, or if the behavior is 39 | threatening or harassing, report it. We are dedicated to providing an 40 | environment where participants feel welcome and safe. 41 | 42 | ## Reporting problems 43 | 44 | Some Google open source projects may adopt a project-specific code of conduct. 45 | In those cases, a Google employee will be identified as the Project Steward, 46 | who will receive and handle reports of code of conduct violations. In the event 47 | that a project hasn’t identified a Project Steward, you can report problems by 48 | emailing opensource@google.com. 49 | 50 | We will investigate every complaint, but you may not receive a direct response. 51 | We will use our discretion in determining when and how to follow up on reported 52 | incidents, which may range from not taking action to permanent expulsion from 53 | the project and project-sponsored spaces. We will notify the accused of the 54 | report and provide them an opportunity to discuss it before any action is 55 | taken. The identity of the reporter will be omitted from the details of the 56 | report supplied to the accused. In potentially harmful situations, such as 57 | ongoing harassment or threats to anyone's safety, we may take action without 58 | notice. 59 | 60 | *This document was adapted from the [IndieWeb Code of Conduct][] and can also 61 | be found at .* 62 | 63 | [IndieWeb Code of Conduct]: https://indieweb.org/code-of-conduct 64 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build](https://github.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/actions/workflows/build.yml/badge.svg)](https://github.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/actions/workflows/build.yml) 2 | 3 | ![Contributors](https://img.shields.io/github/contributors/googlemaps-samples/codelab-maps-platform-101-android-kotlin?color=green) 4 | [![License](https://img.shields.io/github/license/googlemaps-samples/codelab-maps-platform-101-android-kotlin?color=blue)][license] 5 | [![StackOverflow](https://img.shields.io/stackexchange/stackoverflow/t/google-maps?color=orange&label=google-maps&logo=stackoverflow)](https://stackoverflow.com/questions/tagged/google-maps) 6 | [![Discord](https://img.shields.io/discord/676948200904589322?color=6A7EC2&logo=discord&logoColor=ffffff)][Discord server] 7 | 8 | # Google Maps Platform 101: Android Codelab 9 | 10 | ![App screenshot](app_screenshot.png) 11 | 12 | ## Description 13 | 14 | Accompanying starter and solution code for the [Google Maps Platform 101: Android Codelab][codelab], a codelab that teaches you how to integrate [Maps SDK for Android][android-sdk] into your app and use its core features. 15 | 16 | ## Requirements 17 | 18 | To run the samples, you will need: 19 | 20 | - To [sign up with Google Maps Platform] 21 | - A Google Maps Platform [project] with the **Maps SDK for Android** enabled 22 | - An [API key] associated with the project above ... follow the [API key instructions] if you're new to the process 23 | - Android Studio 3.6 or higher 24 | 25 | ## Contributing 26 | 27 | Contributions are welcome and encouraged! If you'd like to contribute, send us a [pull request] and refer to our [code of conduct] and [contributing guide]. 28 | 29 | ## Terms of Service 30 | 31 | This sample uses Google Maps Platform services. Use of Google Maps Platform services through this sample is subject to the Google Maps Platform [Terms of Service]. 32 | 33 | This sample is not a Google Maps Platform Core Service. Therefore, the Google Maps Platform Terms of Service (e.g. Technical Support Services, Service Level Agreements, and Deprecation Policy) do not apply to the code in this sample. 34 | 35 | ## Support 36 | 37 | This sample is offered via an open source [license]. It is not governed by the Google Maps Platform Support [Technical Support Services Guidelines], the [SLA], or the [Deprecation Policy]. However, any Google Maps Platform services used by the sample remain subject to the Google Maps Platform Terms of Service. 38 | 39 | If you find a bug, or have a feature request, please [file an issue] on GitHub. If you would like to get answers to technical questions from other Google Maps Platform developers, ask through one of our [developer community channels]. If you'd like to contribute, please check the [contributing guide]. 40 | 41 | You can also discuss this sample on our [Discord server]. 42 | 43 | [codelab]: https://codelabs.developers.google.com/codelabs/maps-platform-101-android 44 | 45 | [android-sdk]: https://developers.google.com/maps/documentation/android-sdk 46 | [API key]: https://developers.google.com/maps/documentation/android-sdk/get-api-key 47 | [API key instructions]: https://developers.google.com/maps/documentation/android-sdk/config#step_3_add_your_api_key_to_the_project 48 | 49 | [code of conduct]: ?tab=coc-ov-file#readme 50 | [contributing guide]: CONTRIBUTING.md 51 | [Deprecation Policy]: https://cloud.google.com/maps-platform/terms 52 | [developer community channels]: https://developers.google.com/maps/developer-community 53 | [Discord server]: https://discord.gg/hYsWbmk 54 | [file an issue]: https://github.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/issues/new/choose 55 | [license]: LICENSE 56 | [pull request]: https://github.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/compare 57 | [project]: https://developers.google.com/maps/documentation/android-sdk/cloud-setup#enabling-apis 58 | [Sign up with Google Maps Platform]: https://console.cloud.google.com/google/maps-apis/start 59 | [SLA]: https://cloud.google.com/maps-platform/terms/sla 60 | [Technical Support Services Guidelines]: https://cloud.google.com/maps-platform/terms/tssg 61 | [Terms of Service]: https://cloud.google.com/maps-platform/terms 62 | -------------------------------------------------------------------------------- /app_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/app_screenshot.png -------------------------------------------------------------------------------- /solution-ktx/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /solution-ktx/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | id 'kotlin-android-extensions' 5 | 6 | // Add secrets-gradle-plugin here 7 | id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' 8 | } 9 | 10 | android { 11 | compileSdk 32 12 | buildToolsVersion "29.0.3" 13 | 14 | defaultConfig { 15 | applicationId "com.google.codelabs.buildyourfirstmap" 16 | minSdk 21 17 | targetSdk 32 18 | versionCode 1 19 | versionName "1.0" 20 | 21 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | 31 | } 32 | 33 | // [START maps_android_add_map_codelab_ktx_dependency] 34 | dependencies { 35 | // [START_EXCLUDE] 36 | implementation fileTree(dir: 'libs', include: ['*.jar']) 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 38 | implementation 'androidx.appcompat:appcompat:1.4.1' 39 | implementation 'androidx.core:core-ktx:1.7.0' 40 | implementation 'com.google.code.gson:gson:2.8.6' 41 | testImplementation 'junit:junit:4.13.2' 42 | 43 | // Dependency to include Maps SDK for Android 44 | implementation 'com.google.android.gms:play-services-maps:18.0.2' 45 | implementation 'com.google.maps.android:android-maps-utils:2.2.0' 46 | // [END_EXCLUDE] 47 | 48 | // Maps SDK for Android KTX Library 49 | implementation 'com.google.maps.android:maps-ktx:3.3.0' 50 | 51 | // Maps SDK for Android Utility Library KTX Library 52 | implementation 'com.google.maps.android:maps-utils-ktx:3.0.0' 53 | 54 | // Lifecycle Runtime KTX Library 55 | implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1' 56 | } 57 | // [END maps_android_add_map_codelab_ktx_dependency] 58 | 59 | secrets { 60 | defaultPropertiesFileName = 'local.properties.defaults' 61 | } -------------------------------------------------------------------------------- /solution-ktx/app/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 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 28 | 29 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/java/com/google/codelabs/buildyourfirstmap/BitmapHelper.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import android.content.Context 18 | import android.graphics.Bitmap 19 | import android.graphics.Canvas 20 | import android.util.Log 21 | import androidx.annotation.ColorInt 22 | import androidx.annotation.DrawableRes 23 | import androidx.core.content.res.ResourcesCompat 24 | import androidx.core.graphics.drawable.DrawableCompat 25 | import com.google.android.gms.maps.model.BitmapDescriptor 26 | import com.google.android.gms.maps.model.BitmapDescriptorFactory 27 | 28 | object BitmapHelper { 29 | /** 30 | * Demonstrates converting a [Drawable] to a [BitmapDescriptor], for use as a marker icon. 31 | * Taken from ApiDemos on GitHub: https://github.com/googlemaps/android-samples/blob/master/ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos/MarkerDemoActivity.kt 32 | */ 33 | fun vectorToBitmap(context: Context, @DrawableRes id: Int, @ColorInt color: Int): BitmapDescriptor { 34 | val vectorDrawable = ResourcesCompat.getDrawable(context.resources, id, null) 35 | if (vectorDrawable == null) { 36 | Log.e("BitmapHelper", "Resource not found") 37 | return BitmapDescriptorFactory.defaultMarker() 38 | } 39 | val bitmap = Bitmap.createBitmap( 40 | vectorDrawable.intrinsicWidth, 41 | vectorDrawable.intrinsicHeight, 42 | Bitmap.Config.ARGB_8888 43 | ) 44 | val canvas = Canvas(bitmap) 45 | vectorDrawable.setBounds(0, 0, canvas.width, canvas.height) 46 | DrawableCompat.setTint(vectorDrawable, color) 47 | vectorDrawable.draw(canvas) 48 | return BitmapDescriptorFactory.fromBitmap(bitmap) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/java/com/google/codelabs/buildyourfirstmap/MainActivity.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import android.os.Bundle 18 | import androidx.appcompat.app.AppCompatActivity 19 | import androidx.core.content.ContextCompat 20 | import androidx.lifecycle.lifecycleScope 21 | import com.google.android.gms.maps.CameraUpdateFactory 22 | import com.google.android.gms.maps.GoogleMap 23 | import com.google.android.gms.maps.SupportMapFragment 24 | import com.google.android.gms.maps.model.* 25 | import com.google.codelabs.buildyourfirstmap.place.Place 26 | import com.google.codelabs.buildyourfirstmap.place.PlaceRenderer 27 | import com.google.codelabs.buildyourfirstmap.place.PlacesReader 28 | import com.google.maps.android.clustering.ClusterManager 29 | import com.google.maps.android.ktx.addCircle 30 | import com.google.maps.android.ktx.addMarker 31 | import com.google.maps.android.ktx.awaitMap 32 | import com.google.maps.android.ktx.awaitMapLoad 33 | import kotlinx.coroutines.launch 34 | 35 | class MainActivity : AppCompatActivity() { 36 | 37 | private val places: List by lazy { 38 | PlacesReader(this).read() 39 | } 40 | 41 | // [START maps_android_add_map_codelab_ktx_coroutines] 42 | override fun onCreate(savedInstanceState: Bundle?) { 43 | super.onCreate(savedInstanceState) 44 | setContentView(R.layout.activity_main) 45 | val mapFragment = 46 | supportFragmentManager.findFragmentById(R.id.map_fragment) as SupportMapFragment 47 | lifecycleScope.launchWhenCreated { 48 | // Get map 49 | val googleMap = mapFragment.awaitMap() 50 | 51 | addClusteredMarkers(googleMap) 52 | 53 | // Wait for map to finish loading 54 | googleMap.awaitMapLoad() 55 | 56 | // Ensure all places are visible in the map 57 | val bounds = LatLngBounds.builder() 58 | places.forEach { bounds.include(it.latLng) } 59 | googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 20)) 60 | } 61 | } 62 | // [END maps_android_add_map_codelab_ktx_coroutines] 63 | 64 | /** 65 | * Adds markers to the map with clustering support. 66 | */ 67 | private fun addClusteredMarkers(googleMap: GoogleMap) { 68 | // Create the ClusterManager class and set the custom renderer 69 | val clusterManager = ClusterManager(this, googleMap) 70 | clusterManager.renderer = 71 | PlaceRenderer( 72 | this, 73 | googleMap, 74 | clusterManager 75 | ) 76 | 77 | // Set custom info window adapter 78 | clusterManager.markerCollection.setInfoWindowAdapter(MarkerInfoWindowAdapter(this)) 79 | 80 | // Add the places to the ClusterManager 81 | clusterManager.addItems(places) 82 | clusterManager.cluster() 83 | 84 | // Show polygon 85 | clusterManager.setOnClusterItemClickListener { item -> 86 | addCircle(googleMap, item) 87 | return@setOnClusterItemClickListener false 88 | } 89 | 90 | // When the camera starts moving, change the alpha value of the marker to translucent 91 | googleMap.setOnCameraMoveStartedListener { 92 | clusterManager.markerCollection.markers.forEach { it.alpha = 0.3f } 93 | clusterManager.clusterMarkerCollection.markers.forEach { it.alpha = 0.3f } 94 | } 95 | 96 | googleMap.setOnCameraIdleListener { 97 | // When the camera stops moving, change the alpha value back to opaque 98 | clusterManager.markerCollection.markers.forEach { it.alpha = 1.0f } 99 | clusterManager.clusterMarkerCollection.markers.forEach { it.alpha = 1.0f } 100 | 101 | // Call clusterManager.onCameraIdle() when the camera stops moving so that re-clustering 102 | // can be performed when the camera stops moving 103 | clusterManager.onCameraIdle() 104 | } 105 | } 106 | 107 | private var circle: Circle? = null 108 | 109 | // [START maps_android_add_map_codelab_ktx_add_circle] 110 | /** 111 | * Adds a [Circle] around the provided [item] 112 | */ 113 | private fun addCircle(googleMap: GoogleMap, item: Place) { 114 | circle?.remove() 115 | circle = googleMap.addCircle { 116 | center(item.latLng) 117 | radius(1000.0) 118 | fillColor(ContextCompat.getColor(this@MainActivity, R.color.colorPrimaryTranslucent)) 119 | strokeColor(ContextCompat.getColor(this@MainActivity, R.color.colorPrimary)) 120 | } 121 | } 122 | // [END maps_android_add_map_codelab_ktx_add_circle] 123 | 124 | private val bicycleIcon: BitmapDescriptor by lazy { 125 | val color = ContextCompat.getColor(this, R.color.colorPrimary) 126 | BitmapHelper.vectorToBitmap(this, R.drawable.ic_directions_bike_black_24dp, color) 127 | } 128 | 129 | // [START maps_android_add_map_codelab_ktx_add_markers] 130 | /** 131 | * Adds markers to the map. These markers won't be clustered. 132 | */ 133 | private fun addMarkers(googleMap: GoogleMap) { 134 | places.forEach { place -> 135 | val marker = googleMap.addMarker { 136 | title(place.name) 137 | position(place.latLng) 138 | icon(bicycleIcon) 139 | } 140 | // Set place as the tag on the marker object so it can be referenced within 141 | // MarkerInfoWindowAdapter 142 | marker?.tag = place 143 | } 144 | } 145 | // [END maps_android_add_map_codelab_ktx_add_markers] 146 | 147 | companion object { 148 | val TAG = MainActivity::class.java.simpleName 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/java/com/google/codelabs/buildyourfirstmap/MarkerInfoWindowAdapter.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import android.content.Context 18 | import android.view.LayoutInflater 19 | import android.view.View 20 | import android.widget.TextView 21 | import com.google.android.gms.maps.GoogleMap 22 | import com.google.android.gms.maps.model.Marker 23 | import com.google.codelabs.buildyourfirstmap.place.Place 24 | 25 | class MarkerInfoWindowAdapter(private val context: Context) : GoogleMap.InfoWindowAdapter { 26 | override fun getInfoContents(marker: Marker): View? { 27 | // 1. Get tag 28 | val place = marker.tag as? Place ?: return null 29 | 30 | // 2. Inflate view and set title, address and rating 31 | val view = LayoutInflater.from(context).inflate(R.layout.marker_info_contents, null) 32 | view.findViewById(R.id.text_view_title).text = place.name 33 | view.findViewById(R.id.text_view_address).text = place.address 34 | view.findViewById(R.id.text_view_rating).text = "Rating: %.2f".format(place.rating) 35 | 36 | return view 37 | } 38 | 39 | override fun getInfoWindow(marker: Marker): View? { 40 | // Return null to indicate that the default window (white bubble) should be used 41 | return null 42 | } 43 | } -------------------------------------------------------------------------------- /solution-ktx/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/Place.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import com.google.android.gms.maps.model.LatLng 18 | import com.google.maps.android.clustering.ClusterItem 19 | 20 | data class Place( 21 | val name: String, 22 | val latLng: LatLng, 23 | val address: String, 24 | val rating: Float 25 | ) : ClusterItem { 26 | override fun getPosition(): LatLng = 27 | latLng 28 | 29 | override fun getTitle(): String = 30 | name 31 | 32 | override fun getSnippet(): String = 33 | address 34 | } 35 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlaceRenderer.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import android.content.Context 18 | import androidx.core.content.ContextCompat 19 | import com.google.android.gms.maps.GoogleMap 20 | import com.google.android.gms.maps.model.BitmapDescriptor 21 | import com.google.android.gms.maps.model.Marker 22 | import com.google.android.gms.maps.model.MarkerOptions 23 | import com.google.codelabs.buildyourfirstmap.BitmapHelper 24 | import com.google.codelabs.buildyourfirstmap.R 25 | import com.google.maps.android.clustering.ClusterManager 26 | import com.google.maps.android.clustering.view.DefaultClusterRenderer 27 | 28 | /** 29 | * A custom cluster renderer for Place objects. 30 | */ 31 | class PlaceRenderer( 32 | private val context: Context, 33 | map: GoogleMap, 34 | clusterManager: ClusterManager 35 | ) : DefaultClusterRenderer(context, map, clusterManager) { 36 | 37 | /** 38 | * The icon to use for each cluster item 39 | */ 40 | private val bicycleIcon: BitmapDescriptor by lazy { 41 | val color = ContextCompat.getColor(context, 42 | R.color.colorPrimary 43 | ) 44 | BitmapHelper.vectorToBitmap( 45 | context, 46 | R.drawable.ic_directions_bike_black_24dp, 47 | color 48 | ) 49 | } 50 | 51 | /** 52 | * Method called before the cluster item (i.e. the marker) is rendered. This is where marker 53 | * options should be set 54 | */ 55 | override fun onBeforeClusterItemRendered(item: Place, markerOptions: MarkerOptions) { 56 | markerOptions.title(item.name) 57 | .position(item.latLng) 58 | .icon(bicycleIcon) 59 | } 60 | 61 | /** 62 | * Method called right after the cluster item (i.e. the marker) is rendered. This is where 63 | * properties for the Marker object should be set. 64 | */ 65 | override fun onClusterItemRendered(clusterItem: Place, marker: Marker) { 66 | marker.tag = clusterItem 67 | } 68 | } -------------------------------------------------------------------------------- /solution-ktx/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlacesReader.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import android.content.Context 18 | import com.google.codelabs.buildyourfirstmap.R 19 | import com.google.gson.Gson 20 | import com.google.gson.reflect.TypeToken 21 | import java.io.InputStream 22 | import java.io.InputStreamReader 23 | 24 | /** 25 | * Reads a list of place JSON objects from the file places.json. 26 | */ 27 | class PlacesReader(private val context: Context) { 28 | 29 | // GSON object responsible for converting from JSON to a Place object 30 | private val gson = Gson() 31 | 32 | // InputStream representing places.json 33 | private val inputStream: InputStream 34 | get() = context.resources.openRawResource(R.raw.places) 35 | 36 | /** 37 | * Reads the list of place JSON objects in the file places.json and returns a list of Place 38 | * objects 39 | */ 40 | fun read(): List { 41 | val itemType = object : TypeToken>() {}.type 42 | val reader = InputStreamReader(inputStream) 43 | return gson.fromJson>(reader, itemType).map { 44 | it.toPlace() 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /solution-ktx/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlacesResponse.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import com.google.android.gms.maps.model.LatLng 18 | 19 | data class PlaceResponse( 20 | val geometry: Geometry, 21 | val name: String, 22 | val vicinity: String, 23 | val rating: Float 24 | ) { 25 | 26 | data class Geometry( 27 | val location: GeometryLocation 28 | ) 29 | 30 | data class GeometryLocation( 31 | val lat: Double, 32 | val lng: Double 33 | ) 34 | } 35 | 36 | fun PlaceResponse.toPlace(): Place = Place( 37 | name = name, 38 | latLng = LatLng(geometry.location.lat, geometry.location.lng), 39 | address = vicinity, 40 | rating = rating 41 | ) 42 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 25 | 31 | 34 | 37 | 38 | 39 | 40 | 46 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/drawable/ic_directions_bike_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 176 | 181 | 186 | 187 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 29 | 30 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/layout/marker_info_contents.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 25 | 26 | 34 | 35 | 42 | 43 | 50 | 51 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #6200EE 20 | #556200EE 21 | #3700B3 22 | #03DAC5 23 | 24 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | BuildYourFirstMap 19 | 20 | -------------------------------------------------------------------------------- /solution-ktx/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /solution-ktx/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.5.30' 5 | repositories { 6 | google() 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:7.0.4' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1" 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | mavenCentral() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | -------------------------------------------------------------------------------- /solution-ktx/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /solution-ktx/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution-ktx/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /solution-ktx/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 30 10:52:04 PDT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip 7 | -------------------------------------------------------------------------------- /solution-ktx/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /solution-ktx/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /solution-ktx/local.properties.defaults: -------------------------------------------------------------------------------- 1 | GOOGLE_MAPS_API_KEY=YOUR_API_KEY 2 | -------------------------------------------------------------------------------- /solution-ktx/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='BuildYourFirstMap' 2 | include ':app' 3 | -------------------------------------------------------------------------------- /solution/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /solution/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | id 'kotlin-android-extensions' 5 | 6 | // Add secrets-gradle-plugin here 7 | id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' 8 | } 9 | 10 | android { 11 | compileSdk 32 12 | buildToolsVersion "29.0.3" 13 | 14 | defaultConfig { 15 | applicationId "com.google.codelabs.buildyourfirstmap" 16 | minSdk 21 17 | targetSdk 32 18 | versionCode 1 19 | versionName "1.0" 20 | 21 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | 31 | } 32 | 33 | dependencies { 34 | implementation fileTree(dir: 'libs', include: ['*.jar']) 35 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 36 | implementation 'androidx.appcompat:appcompat:1.4.1' 37 | implementation 'androidx.core:core-ktx:1.7.0' 38 | implementation 'com.google.code.gson:gson:2.8.6' 39 | 40 | // Dependency to include Maps SDK for Android 41 | implementation 'com.google.android.gms:play-services-maps:18.0.2' 42 | implementation 'com.google.maps.android:android-maps-utils:2.2.0' 43 | 44 | testImplementation 'junit:junit:4.13.2' 45 | } 46 | 47 | secrets { 48 | defaultPropertiesFileName = 'local.properties.defaults' 49 | } -------------------------------------------------------------------------------- /solution/app/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 | -------------------------------------------------------------------------------- /solution/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 28 | 29 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /solution/app/src/main/java/com/google/codelabs/buildyourfirstmap/BitmapHelper.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import android.content.Context 18 | import android.graphics.Bitmap 19 | import android.graphics.Canvas 20 | import android.util.Log 21 | import androidx.annotation.ColorInt 22 | import androidx.annotation.DrawableRes 23 | import androidx.core.content.res.ResourcesCompat 24 | import androidx.core.graphics.drawable.DrawableCompat 25 | import com.google.android.gms.maps.model.BitmapDescriptor 26 | import com.google.android.gms.maps.model.BitmapDescriptorFactory 27 | 28 | object BitmapHelper { 29 | /** 30 | * Demonstrates converting a [Drawable] to a [BitmapDescriptor], for use as a marker icon. 31 | * Taken from ApiDemos on GitHub: https://github.com/googlemaps/android-samples/blob/master/ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos/MarkerDemoActivity.kt 32 | */ 33 | fun vectorToBitmap(context: Context, @DrawableRes id: Int, @ColorInt color: Int): BitmapDescriptor { 34 | val vectorDrawable = ResourcesCompat.getDrawable(context.resources, id, null) 35 | if (vectorDrawable == null) { 36 | Log.e("BitmapHelper", "Resource not found") 37 | return BitmapDescriptorFactory.defaultMarker() 38 | } 39 | val bitmap = Bitmap.createBitmap( 40 | vectorDrawable.intrinsicWidth, 41 | vectorDrawable.intrinsicHeight, 42 | Bitmap.Config.ARGB_8888 43 | ) 44 | val canvas = Canvas(bitmap) 45 | vectorDrawable.setBounds(0, 0, canvas.width, canvas.height) 46 | DrawableCompat.setTint(vectorDrawable, color) 47 | vectorDrawable.draw(canvas) 48 | return BitmapDescriptorFactory.fromBitmap(bitmap) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /solution/app/src/main/java/com/google/codelabs/buildyourfirstmap/MainActivity.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import android.os.Bundle 18 | import androidx.appcompat.app.AppCompatActivity 19 | import androidx.core.content.ContextCompat 20 | import com.google.android.gms.maps.CameraUpdateFactory 21 | import com.google.android.gms.maps.GoogleMap 22 | import com.google.android.gms.maps.SupportMapFragment 23 | import com.google.android.gms.maps.model.* 24 | import com.google.codelabs.buildyourfirstmap.place.Place 25 | import com.google.codelabs.buildyourfirstmap.place.PlaceRenderer 26 | import com.google.codelabs.buildyourfirstmap.place.PlacesReader 27 | import com.google.maps.android.clustering.ClusterManager 28 | 29 | class MainActivity : AppCompatActivity() { 30 | 31 | private val places: List by lazy { 32 | PlacesReader(this).read() 33 | } 34 | 35 | override fun onCreate(savedInstanceState: Bundle?) { 36 | super.onCreate(savedInstanceState) 37 | setContentView(R.layout.activity_main) 38 | val mapFragment = 39 | supportFragmentManager.findFragmentById(R.id.map_fragment) as? SupportMapFragment 40 | mapFragment?.getMapAsync { googleMap -> 41 | // Ensure all places are visible in the map 42 | googleMap.setOnMapLoadedCallback { 43 | val bounds = LatLngBounds.builder() 44 | places.forEach { bounds.include(it.latLng) } 45 | googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 20)) 46 | } 47 | 48 | //addMarkers(googleMap) 49 | addClusteredMarkers(googleMap) 50 | 51 | // Set custom info window adapter 52 | // googleMap.setInfoWindowAdapter(MarkerInfoWindowAdapter(this)) 53 | } 54 | } 55 | 56 | /** 57 | * Adds markers to the map with clustering support. 58 | */ 59 | private fun addClusteredMarkers(googleMap: GoogleMap) { 60 | // Create the ClusterManager class and set the custom renderer 61 | val clusterManager = ClusterManager(this, googleMap) 62 | clusterManager.renderer = 63 | PlaceRenderer( 64 | this, 65 | googleMap, 66 | clusterManager 67 | ) 68 | 69 | // Set custom info window adapter 70 | clusterManager.markerCollection.setInfoWindowAdapter(MarkerInfoWindowAdapter(this)) 71 | 72 | // Add the places to the ClusterManager 73 | clusterManager.addItems(places) 74 | clusterManager.cluster() 75 | 76 | // Show polygon 77 | clusterManager.setOnClusterItemClickListener { item -> 78 | addCircle(googleMap, item) 79 | return@setOnClusterItemClickListener false 80 | } 81 | 82 | // When the camera starts moving, change the alpha value of the marker to translucent 83 | googleMap.setOnCameraMoveStartedListener { 84 | clusterManager.markerCollection.markers.forEach { it.alpha = 0.3f } 85 | clusterManager.clusterMarkerCollection.markers.forEach { it.alpha = 0.3f } 86 | } 87 | 88 | googleMap.setOnCameraIdleListener { 89 | // When the camera stops moving, change the alpha value back to opaque 90 | clusterManager.markerCollection.markers.forEach { it.alpha = 1.0f } 91 | clusterManager.clusterMarkerCollection.markers.forEach { it.alpha = 1.0f } 92 | 93 | // Call clusterManager.onCameraIdle() when the camera stops moving so that re-clustering 94 | // can be performed when the camera stops moving 95 | clusterManager.onCameraIdle() 96 | } 97 | } 98 | 99 | private var circle: Circle? = null 100 | 101 | /** 102 | * Adds a [Circle] around the provided [item] 103 | */ 104 | private fun addCircle(googleMap: GoogleMap, item: Place) { 105 | circle?.remove() 106 | circle = googleMap.addCircle( 107 | CircleOptions() 108 | .center(item.latLng) 109 | .radius(1000.0) 110 | .fillColor(ContextCompat.getColor(this, R.color.colorPrimaryTranslucent)) 111 | .strokeColor(ContextCompat.getColor(this, R.color.colorPrimary)) 112 | ) 113 | } 114 | 115 | private val bicycleIcon: BitmapDescriptor by lazy { 116 | val color = ContextCompat.getColor(this, R.color.colorPrimary) 117 | BitmapHelper.vectorToBitmap(this, R.drawable.ic_directions_bike_black_24dp, color) 118 | } 119 | 120 | /** 121 | * Adds markers to the map. These markers won't be clustered. 122 | */ 123 | private fun addMarkers(googleMap: GoogleMap) { 124 | places.forEach { place -> 125 | val marker = googleMap.addMarker( 126 | MarkerOptions() 127 | .title(place.name) 128 | .position(place.latLng) 129 | .icon(bicycleIcon) 130 | ) 131 | // Set place as the tag on the marker object so it can be referenced within 132 | // MarkerInfoWindowAdapter 133 | marker?.tag = place 134 | } 135 | } 136 | 137 | companion object { 138 | val TAG = MainActivity::class.java.simpleName 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /solution/app/src/main/java/com/google/codelabs/buildyourfirstmap/MarkerInfoWindowAdapter.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import android.content.Context 18 | import android.view.LayoutInflater 19 | import android.view.View 20 | import android.widget.TextView 21 | import com.google.android.gms.maps.GoogleMap 22 | import com.google.android.gms.maps.model.Marker 23 | import com.google.codelabs.buildyourfirstmap.place.Place 24 | 25 | class MarkerInfoWindowAdapter(private val context: Context) : GoogleMap.InfoWindowAdapter { 26 | override fun getInfoContents(marker: Marker): View? { 27 | // 1. Get tag 28 | val place = marker.tag as? Place ?: return null 29 | 30 | // 2. Inflate view and set title, address and rating 31 | val view = LayoutInflater.from(context).inflate(R.layout.marker_info_contents, null) 32 | view.findViewById(R.id.text_view_title).text = place.name 33 | view.findViewById(R.id.text_view_address).text = place.address 34 | view.findViewById(R.id.text_view_rating).text = "Rating: %.2f".format(place.rating) 35 | 36 | return view 37 | } 38 | 39 | override fun getInfoWindow(marker: Marker): View? { 40 | // Return null to indicate that the default window (white bubble) should be used 41 | return null 42 | } 43 | } -------------------------------------------------------------------------------- /solution/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/Place.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import com.google.android.gms.maps.model.LatLng 18 | import com.google.maps.android.clustering.ClusterItem 19 | 20 | data class Place( 21 | val name: String, 22 | val latLng: LatLng, 23 | val address: String, 24 | val rating: Float 25 | ) : ClusterItem { 26 | override fun getPosition(): LatLng = 27 | latLng 28 | 29 | override fun getTitle(): String = 30 | name 31 | 32 | override fun getSnippet(): String = 33 | address 34 | } 35 | -------------------------------------------------------------------------------- /solution/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlaceRenderer.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import android.content.Context 18 | import androidx.core.content.ContextCompat 19 | import com.google.android.gms.maps.GoogleMap 20 | import com.google.android.gms.maps.model.BitmapDescriptor 21 | import com.google.android.gms.maps.model.Marker 22 | import com.google.android.gms.maps.model.MarkerOptions 23 | import com.google.codelabs.buildyourfirstmap.BitmapHelper 24 | import com.google.codelabs.buildyourfirstmap.R 25 | import com.google.maps.android.clustering.ClusterManager 26 | import com.google.maps.android.clustering.view.DefaultClusterRenderer 27 | 28 | /** 29 | * A custom cluster renderer for Place objects. 30 | */ 31 | class PlaceRenderer( 32 | private val context: Context, 33 | map: GoogleMap, 34 | clusterManager: ClusterManager 35 | ) : DefaultClusterRenderer(context, map, clusterManager) { 36 | 37 | /** 38 | * The icon to use for each cluster item 39 | */ 40 | private val bicycleIcon: BitmapDescriptor by lazy { 41 | val color = ContextCompat.getColor(context, 42 | R.color.colorPrimary 43 | ) 44 | BitmapHelper.vectorToBitmap( 45 | context, 46 | R.drawable.ic_directions_bike_black_24dp, 47 | color 48 | ) 49 | } 50 | 51 | /** 52 | * Method called before the cluster item (i.e. the marker) is rendered. This is where marker 53 | * options should be set 54 | */ 55 | override fun onBeforeClusterItemRendered(item: Place, markerOptions: MarkerOptions) { 56 | markerOptions.title(item.name) 57 | .position(item.latLng) 58 | .icon(bicycleIcon) 59 | } 60 | 61 | /** 62 | * Method called right after the cluster item (i.e. the marker) is rendered. This is where 63 | * properties for the Marker object should be set. 64 | */ 65 | override fun onClusterItemRendered(clusterItem: Place, marker: Marker) { 66 | marker.tag = clusterItem 67 | } 68 | } -------------------------------------------------------------------------------- /solution/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlacesReader.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import android.content.Context 18 | import com.google.codelabs.buildyourfirstmap.R 19 | import com.google.gson.Gson 20 | import com.google.gson.reflect.TypeToken 21 | import java.io.InputStream 22 | import java.io.InputStreamReader 23 | 24 | /** 25 | * Reads a list of place JSON objects from the file places.json. 26 | */ 27 | class PlacesReader(private val context: Context) { 28 | 29 | // GSON object responsible for converting from JSON to a Place object 30 | private val gson = Gson() 31 | 32 | // InputStream representing places.json 33 | private val inputStream: InputStream 34 | get() = context.resources.openRawResource(R.raw.places) 35 | 36 | /** 37 | * Reads the list of place JSON objects in the file places.json and returns a list of Place 38 | * objects 39 | */ 40 | fun read(): List { 41 | val itemType = object : TypeToken>() {}.type 42 | val reader = InputStreamReader(inputStream) 43 | return gson.fromJson>(reader, itemType).map { 44 | it.toPlace() 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /solution/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlacesResponse.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import com.google.android.gms.maps.model.LatLng 18 | 19 | data class PlaceResponse( 20 | val geometry: Geometry, 21 | val name: String, 22 | val vicinity: String, 23 | val rating: Float 24 | ) { 25 | 26 | data class Geometry( 27 | val location: GeometryLocation 28 | ) 29 | 30 | data class GeometryLocation( 31 | val lat: Double, 32 | val lng: Double 33 | ) 34 | } 35 | 36 | fun PlaceResponse.toPlace(): Place = Place( 37 | name = name, 38 | latLng = LatLng(geometry.location.lat, geometry.location.lng), 39 | address = vicinity, 40 | rating = rating 41 | ) 42 | -------------------------------------------------------------------------------- /solution/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 25 | 31 | 34 | 37 | 38 | 39 | 40 | 46 | -------------------------------------------------------------------------------- /solution/app/src/main/res/drawable/ic_directions_bike_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /solution/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 176 | 181 | 186 | 187 | -------------------------------------------------------------------------------- /solution/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 30 | 31 | -------------------------------------------------------------------------------- /solution/app/src/main/res/layout/marker_info_contents.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 25 | 26 | 34 | 35 | 42 | 43 | 50 | 51 | -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /solution/app/src/main/res/raw/places.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "geometry": { 4 | "location": { 5 | "lat": 37.7557557, 6 | "lng": -122.4208508 7 | }, 8 | "viewport": { 9 | "northeast": { 10 | "lat": 37.7571005802915, 11 | "lng": -122.4195916697085 12 | }, 13 | "southwest": { 14 | "lat": 37.75440261970851, 15 | "lng": -122.4222896302915 16 | } 17 | } 18 | }, 19 | "name": "Valencia Cyclery", 20 | "rating": 4.2, 21 | "vicinity": "1077 Valencia Street, San Francisco" 22 | }, 23 | { 24 | "geometry": { 25 | "location": { 26 | "lat": 37.80764569999999, 27 | "lng": -122.4195251 28 | }, 29 | "viewport": { 30 | "northeast": { 31 | "lat": 37.8090395802915, 32 | "lng": -122.4181850697085 33 | }, 34 | "southwest": { 35 | "lat": 37.8063416197085, 36 | "lng": -122.4208830302915 37 | } 38 | } 39 | }, 40 | "name": "San Francisco Bicycle Rentals", 41 | "rating": 4.5, 42 | "vicinity": "425 Jefferson Street, San Francisco" 43 | }, 44 | { 45 | "geometry": { 46 | "location": { 47 | "lat": 37.7757292, 48 | "lng": -122.4119508 49 | }, 50 | "viewport": { 51 | "northeast": { 52 | "lat": 37.7771379302915, 53 | "lng": -122.4106816697085 54 | }, 55 | "southwest": { 56 | "lat": 37.7744399697085, 57 | "lng": -122.4133796302915 58 | } 59 | } 60 | }, 61 | "name": "Mike's Bikes of San Francisco", 62 | "rating": 4, 63 | "vicinity": "1233 Howard Street, San Francisco" 64 | }, 65 | { 66 | "geometry": { 67 | "location": { 68 | "lat": 37.8060487, 69 | "lng": -122.4206076 70 | }, 71 | "viewport": { 72 | "northeast": { 73 | "lat": 37.8074053802915, 74 | "lng": -122.4191828197085 75 | }, 76 | "southwest": { 77 | "lat": 37.80470741970851, 78 | "lng": -122.4218807802915 79 | } 80 | } 81 | }, 82 | "name": "Blazing Saddles Bike Rentals & Tours", 83 | "rating": 4.1, 84 | "vicinity": "2715 Hyde Street, San Francisco" 85 | }, 86 | { 87 | "geometry": { 88 | "location": { 89 | "lat": 37.7809098, 90 | "lng": -122.4117142 91 | }, 92 | "viewport": { 93 | "northeast": { 94 | "lat": 37.7823185302915, 95 | "lng": -122.4104349697085 96 | }, 97 | "southwest": { 98 | "lat": 37.7796205697085, 99 | "lng": -122.4131329302915 100 | } 101 | } 102 | }, 103 | "name": "Huckleberry Bicycles", 104 | "rating": 4.7, 105 | "vicinity": "Huckleberry Bicycles, 1073 Market Street, San Francisco" 106 | }, 107 | { 108 | "geometry": { 109 | "location": { 110 | "lat": 37.7665228, 111 | "lng": -122.4532875 112 | }, 113 | "viewport": { 114 | "northeast": { 115 | "lat": 37.7678018302915, 116 | "lng": -122.4518091697085 117 | }, 118 | "southwest": { 119 | "lat": 37.7651038697085, 120 | "lng": -122.4545071302915 121 | } 122 | } 123 | }, 124 | "name": "American Cyclery", 125 | "rating": 4.5, 126 | "vicinity": "510 Frederick Street, San Francisco" 127 | }, 128 | { 129 | "geometry": { 130 | "location": { 131 | "lat": 37.7390085, 132 | "lng": -122.4172602 133 | }, 134 | "viewport": { 135 | "northeast": { 136 | "lat": 37.7404190302915, 137 | "lng": -122.4159020697085 138 | }, 139 | "southwest": { 140 | "lat": 37.7377210697085, 141 | "lng": -122.4186000302915 142 | } 143 | } 144 | }, 145 | "name": "The New Wheel Electric Bikes", 146 | "rating": 4.8, 147 | "vicinity": "420 Cortland Avenue, San Francisco" 148 | }, 149 | { 150 | "geometry": { 151 | "location": { 152 | "lat": 37.7681295, 153 | "lng": -122.4240983 154 | }, 155 | "viewport": { 156 | "northeast": { 157 | "lat": 37.7694318302915, 158 | "lng": -122.4227560197085 159 | }, 160 | "southwest": { 161 | "lat": 37.7667338697085, 162 | "lng": -122.4254539802915 163 | } 164 | } 165 | }, 166 | "name": "Box Dog Bikes", 167 | "rating": 4.4, 168 | "vicinity": "494 14th Street, San Francisco" 169 | }, 170 | { 171 | "geometry": { 172 | "location": { 173 | "lat": 37.7609808, 174 | "lng": -122.4115807 175 | }, 176 | "viewport": { 177 | "northeast": { 178 | "lat": 37.7623453302915, 179 | "lng": -122.4099669197085 180 | }, 181 | "southwest": { 182 | "lat": 37.7596473697085, 183 | "lng": -122.4126648802915 184 | } 185 | } 186 | }, 187 | "name": "The Bike Kitchen", 188 | "rating": 4.8, 189 | "vicinity": "650H Florida Street, San Francisco" 190 | }, 191 | { 192 | "geometry": { 193 | "location": { 194 | "lat": 37.76308280000001, 195 | "lng": -122.4855866 196 | }, 197 | "viewport": { 198 | "northeast": { 199 | "lat": 37.7644915302915, 200 | "lng": -122.4842422197085 201 | }, 202 | "southwest": { 203 | "lat": 37.7617935697085, 204 | "lng": -122.4869401802915 205 | } 206 | } 207 | }, 208 | "name": "Nomad Cyclery", 209 | "rating": 4.2, 210 | "vicinity": "2555 Irving Street, San Francisco" 211 | }, 212 | { 213 | "geometry": { 214 | "location": { 215 | "lat": 37.76801260000001, 216 | "lng": -122.453139 217 | }, 218 | "viewport": { 219 | "northeast": { 220 | "lat": 37.7693494302915, 221 | "lng": -122.4518814697085 222 | }, 223 | "southwest": { 224 | "lat": 37.7666514697085, 225 | "lng": -122.4545794302915 226 | } 227 | } 228 | }, 229 | "name": "Avenue Cyclery", 230 | "rating": 4.8, 231 | "vicinity": "756 Stanyan Street, San Francisco" 232 | }, 233 | { 234 | "geometry": { 235 | "location": { 236 | "lat": 37.77704, 237 | "lng": -122.407791 238 | }, 239 | "viewport": { 240 | "northeast": { 241 | "lat": 37.7783157302915, 242 | "lng": -122.4063946197085 243 | }, 244 | "southwest": { 245 | "lat": 37.7756177697085, 246 | "lng": -122.4090925802915 247 | } 248 | } 249 | }, 250 | "name": "Bike Connection", 251 | "rating": 4.7, 252 | "vicinity": "1090 Folsom Street, San Francisco" 253 | }, 254 | { 255 | "geometry": { 256 | "location": { 257 | "lat": 37.7966337, 258 | "lng": -122.4233637 259 | }, 260 | "viewport": { 261 | "northeast": { 262 | "lat": 37.7979723302915, 263 | "lng": -122.4220973697085 264 | }, 265 | "southwest": { 266 | "lat": 37.7952743697085, 267 | "lng": -122.4247953302915 268 | } 269 | } 270 | }, 271 | "name": "Big Swingin' Cycles", 272 | "rating": 4.7, 273 | "vicinity": "2260 Van Ness Avenue, San Francisco" 274 | }, 275 | { 276 | "geometry": { 277 | "location": { 278 | "lat": 37.7254104, 279 | "lng": -122.463086 280 | }, 281 | "viewport": { 282 | "northeast": { 283 | "lat": 37.7268339302915, 284 | "lng": -122.4616915697085 285 | }, 286 | "southwest": { 287 | "lat": 37.7241359697085, 288 | "lng": -122.4643895302915 289 | } 290 | } 291 | }, 292 | "name": "Ocean Cyclery", 293 | "rating": 4.2, 294 | "vicinity": "1935 Ocean Avenue, San Francisco" 295 | }, 296 | { 297 | "geometry": { 298 | "location": { 299 | "lat": 37.8000584, 300 | "lng": -122.43339 301 | }, 302 | "viewport": { 303 | "northeast": { 304 | "lat": 37.8014504302915, 305 | "lng": -122.4320496697085 306 | }, 307 | "southwest": { 308 | "lat": 37.7987524697085, 309 | "lng": -122.4347476302915 310 | } 311 | } 312 | }, 313 | "name": "New Holiday Adventure Sale", 314 | "rating": 4.7, 315 | "vicinity": "1937 Lombard Street, San Francisco" 316 | }, 317 | { 318 | "geometry": { 319 | "location": { 320 | "lat": 37.8021495, 321 | "lng": -122.4130941 322 | }, 323 | "viewport": { 324 | "northeast": { 325 | "lat": 37.8035485802915, 326 | "lng": -122.4117581197085 327 | }, 328 | "southwest": { 329 | "lat": 37.80085061970851, 330 | "lng": -122.4144560802915 331 | } 332 | } 333 | }, 334 | "name": "Columbus Cyclery Go Bike It", 335 | "rating": 4.3, 336 | "vicinity": "2011 Mason Street, San Francisco" 337 | }, 338 | { 339 | "geometry": { 340 | "location": { 341 | "lat": 37.7888323, 342 | "lng": -122.4185479 343 | }, 344 | "viewport": { 345 | "northeast": { 346 | "lat": 37.7902431802915, 347 | "lng": -122.4171441697085 348 | }, 349 | "southwest": { 350 | "lat": 37.7875452197085, 351 | "lng": -122.4198421302915 352 | } 353 | } 354 | }, 355 | "name": "3D Bike Fit", 356 | "rating": 4.8, 357 | "vicinity": "1299 Bush Street suite c, San Francisco" 358 | }, 359 | { 360 | "geometry": { 361 | "location": { 362 | "lat": 37.7745003, 363 | "lng": -122.4205554 364 | }, 365 | "viewport": { 366 | "northeast": { 367 | "lat": 37.7757722302915, 368 | "lng": -122.4191858697085 369 | }, 370 | "southwest": { 371 | "lat": 37.7730742697085, 372 | "lng": -122.4218838302915 373 | } 374 | } 375 | }, 376 | "name": "Market Street Cycles", 377 | "rating": 4.7, 378 | "vicinity": "1592 Market Street, San Francisco" 379 | }, 380 | { 381 | "geometry": { 382 | "location": { 383 | "lat": 37.773885, 384 | "lng": -122.448161 385 | }, 386 | "viewport": { 387 | "northeast": { 388 | "lat": 37.77514018029149, 389 | "lng": -122.4468136697085 390 | }, 391 | "southwest": { 392 | "lat": 37.77244221970849, 393 | "lng": -122.4495116302915 394 | } 395 | } 396 | }, 397 | "name": "Freewheel Bike Shop", 398 | "rating": 4.4, 399 | "vicinity": "1920 Hayes Street #1126, San Francisco" 400 | }, 401 | { 402 | "geometry": { 403 | "location": { 404 | "lat": 37.7898751, 405 | "lng": -122.439792 406 | }, 407 | "viewport": { 408 | "northeast": { 409 | "lat": 37.7912912802915, 410 | "lng": -122.4384582697085 411 | }, 412 | "southwest": { 413 | "lat": 37.7885933197085, 414 | "lng": -122.4411562302915 415 | } 416 | } 417 | }, 418 | "name": "Bespoke Cycles", 419 | "rating": 4.1, 420 | "vicinity": "2843 Clay Street, San Francisco" 421 | }, 422 | { 423 | "geometry": { 424 | "location": { 425 | "lat": 37.781654, 426 | "lng": -122.387684 427 | }, 428 | "viewport": { 429 | "northeast": { 430 | "lat": 37.7829885302915, 431 | "lng": -122.3863184697085 432 | }, 433 | "southwest": { 434 | "lat": 37.78029056970851, 435 | "lng": -122.3890164302915 436 | } 437 | } 438 | }, 439 | "name": "The Bike Hut", 440 | "rating": 4.8, 441 | "vicinity": "40 Pier Suite #15, San Francisco" 442 | }, 443 | { 444 | "geometry": { 445 | "location": { 446 | "lat": 37.7813758, 447 | "lng": -122.4118395 448 | }, 449 | "viewport": { 450 | "northeast": { 451 | "lat": 37.78263918029149, 452 | "lng": -122.4104188197085 453 | }, 454 | "southwest": { 455 | "lat": 37.77994121970849, 456 | "lng": -122.4131167802915 457 | } 458 | } 459 | }, 460 | "name": "Warm Planet Bikes", 461 | "rating": 4.6, 462 | "vicinity": "1098A Market Street, San Francisco" 463 | }, 464 | { 465 | "geometry": { 466 | "location": { 467 | "lat": 37.76902860000001, 468 | "lng": -122.4516932 469 | }, 470 | "viewport": { 471 | "northeast": { 472 | "lat": 37.7703448802915, 473 | "lng": -122.4504006197085 474 | }, 475 | "southwest": { 476 | "lat": 37.7676469197085, 477 | "lng": -122.4530985802915 478 | } 479 | } 480 | }, 481 | "name": "Bay City Bike Rentals and Tours", 482 | "rating": 2.8, 483 | "vicinity": "622 Shrader Street, San Francisco" 484 | }, 485 | { 486 | "geometry": { 487 | "location": { 488 | "lat": 37.7626507, 489 | "lng": -122.500898 490 | }, 491 | "viewport": { 492 | "northeast": { 493 | "lat": 37.7639357302915, 494 | "lng": -122.4995425697085 495 | }, 496 | "southwest": { 497 | "lat": 37.76123776970851, 498 | "lng": -122.5022405302915 499 | } 500 | } 501 | }, 502 | "name": "Swell Bicycles", 503 | "rating": 4.7, 504 | "vicinity": "4002 Irving Street, San Francisco" 505 | }, 506 | { 507 | "geometry": { 508 | "location": { 509 | "lat": 37.7821259, 510 | "lng": -122.4796947 511 | }, 512 | "viewport": { 513 | "northeast": { 514 | "lat": 37.7835457802915, 515 | "lng": -122.4783494197085 516 | }, 517 | "southwest": { 518 | "lat": 37.7808478197085, 519 | "lng": -122.4810473802915 520 | } 521 | } 522 | }, 523 | "name": "Spoke Easy SF", 524 | "rating": 4.8, 525 | "vicinity": "1901 Clement Street, San Francisco" 526 | }, 527 | { 528 | "geometry": { 529 | "location": { 530 | "lat": 37.8052292, 531 | "lng": -122.4687234 532 | }, 533 | "viewport": { 534 | "northeast": { 535 | "lat": 37.8065365802915, 536 | "lng": -122.4673546197085 537 | }, 538 | "southwest": { 539 | "lat": 37.8038386197085, 540 | "lng": -122.4700525802915 541 | } 542 | } 543 | }, 544 | "name": "Roaring Mouse Cycles", 545 | "rating": 4.8, 546 | "vicinity": "934 Mason Street, San Francisco" 547 | }, 548 | { 549 | "geometry": { 550 | "location": { 551 | "lat": 37.7970276, 552 | "lng": -122.4374123 553 | }, 554 | "viewport": { 555 | "northeast": { 556 | "lat": 37.7983872802915, 557 | "lng": -122.4359504197085 558 | }, 559 | "southwest": { 560 | "lat": 37.7956893197085, 561 | "lng": -122.4386483802915 562 | } 563 | } 564 | }, 565 | "name": "Trek Bicycle San Francisco Cow Hollow", 566 | "rating": 4.9, 567 | "vicinity": "3001 Steiner Street, San Francisco" 568 | }, 569 | { 570 | "geometry": { 571 | "location": { 572 | "lat": 37.7847701, 573 | "lng": -122.4149833 574 | }, 575 | "viewport": { 576 | "northeast": { 577 | "lat": 37.78603663029151, 578 | "lng": -122.4136177697085 579 | }, 580 | "southwest": { 581 | "lat": 37.78333866970851, 582 | "lng": -122.4163157302915 583 | } 584 | } 585 | }, 586 | "name": "San Francisco Yellow Bike Project", 587 | "rating": 4.9, 588 | "vicinity": "530 Ellis Street, San Francisco" 589 | }, 590 | { 591 | "geometry": { 592 | "location": { 593 | "lat": 37.767451, 594 | "lng": -122.406328 595 | }, 596 | "viewport": { 597 | "northeast": { 598 | "lat": 37.7686652302915, 599 | "lng": -122.4048721697085 600 | }, 601 | "southwest": { 602 | "lat": 37.7659672697085, 603 | "lng": -122.4075701302915 604 | } 605 | } 606 | }, 607 | "name": "Moox, Inc", 608 | "vicinity": "550 15th Street M15, San Francisco" 609 | }, 610 | { 611 | "geometry": { 612 | "location": { 613 | "lat": 37.7854464, 614 | "lng": -122.4149153 615 | }, 616 | "viewport": { 617 | "northeast": { 618 | "lat": 37.78685873029149, 619 | "lng": -122.4135320197085 620 | }, 621 | "southwest": { 622 | "lat": 37.7841607697085, 623 | "lng": -122.4162299802915 624 | } 625 | } 626 | }, 627 | "name": "Golden Gate Rides Bike Rentals & Tours", 628 | "rating": 4.8, 629 | "vicinity": "609 O'Farrell Street, San Francisco" 630 | }, 631 | { 632 | "geometry": { 633 | "location": { 634 | "lat": 37.8038932, 635 | "lng": -122.4336986 636 | }, 637 | "viewport": { 638 | "northeast": { 639 | "lat": 37.8053059302915, 640 | "lng": -122.4323626197085 641 | }, 642 | "southwest": { 643 | "lat": 37.8026079697085, 644 | "lng": -122.4350605802915 645 | } 646 | } 647 | }, 648 | "name": "P-Fits/Fitted By Pedro", 649 | "rating": 5, 650 | "vicinity": "1601 North Point Street, San Francisco" 651 | }, 652 | { 653 | "geometry": { 654 | "location": { 655 | "lat": 37.8069867, 656 | "lng": -122.4159246 657 | }, 658 | "viewport": { 659 | "northeast": { 660 | "lat": 37.80835658029149, 661 | "lng": -122.4144072197085 662 | }, 663 | "southwest": { 664 | "lat": 37.8056586197085, 665 | "lng": -122.4171051802915 666 | } 667 | } 668 | }, 669 | "name": "aluguel de Bikes", 670 | "vicinity": "2662 Taylor Street, San Francisco" 671 | }, 672 | { 673 | "geometry": { 674 | "location": { 675 | "lat": 37.759221, 676 | "lng": -122.3882565 677 | }, 678 | "viewport": { 679 | "northeast": { 680 | "lat": 37.7608753302915, 681 | "lng": -122.3869928697085 682 | }, 683 | "southwest": { 684 | "lat": 37.7581773697085, 685 | "lng": -122.3896908302915 686 | } 687 | } 688 | }, 689 | "name": "Velocipede Cyclery", 690 | "rating": 4.8, 691 | "vicinity": "2405 3rd Street, San Francisco" 692 | }, 693 | { 694 | "geometry": { 695 | "location": { 696 | "lat": 37.7646051, 697 | "lng": -122.4311096 698 | }, 699 | "viewport": { 700 | "northeast": { 701 | "lat": 37.7659605802915, 702 | "lng": -122.4296718197085 703 | }, 704 | "southwest": { 705 | "lat": 37.7632626197085, 706 | "lng": -122.4323697802915 707 | } 708 | } 709 | }, 710 | "name": "Mash Transit", 711 | "rating": 4.9, 712 | "vicinity": "284 Sanchez Street, San Francisco" 713 | }, 714 | { 715 | "geometry": { 716 | "location": { 717 | "lat": 37.776337, 718 | "lng": -122.458333 719 | }, 720 | "viewport": { 721 | "northeast": { 722 | "lat": 37.77768133029149, 723 | "lng": -122.4570850197085 724 | }, 725 | "southwest": { 726 | "lat": 37.77498336970849, 727 | "lng": -122.4597829802915 728 | } 729 | } 730 | }, 731 | "name": "San Francyclo", 732 | "rating": 4.4, 733 | "vicinity": "746 Arguello Boulevard, San Francisco" 734 | }, 735 | { 736 | "geometry": { 737 | "location": { 738 | "lat": 37.763987, 739 | "lng": -122.472606 740 | }, 741 | "viewport": { 742 | "northeast": { 743 | "lat": 37.7652273802915, 744 | "lng": -122.4712499697085 745 | }, 746 | "southwest": { 747 | "lat": 37.7625294197085, 748 | "lng": -122.4739479302915 749 | } 750 | } 751 | }, 752 | "name": "Everybody Bikes", 753 | "rating": 4.2, 754 | "vicinity": "1352 Irving Street, San Francisco" 755 | }, 756 | { 757 | "geometry": { 758 | "location": { 759 | "lat": 37.7937392, 760 | "lng": -122.4215543 761 | }, 762 | "viewport": { 763 | "northeast": { 764 | "lat": 37.79509813029149, 765 | "lng": -122.4200974197085 766 | }, 767 | "southwest": { 768 | "lat": 37.79240016970849, 769 | "lng": -122.4227953802915 770 | } 771 | } 772 | }, 773 | "name": "High Trails Cyclery & Mountain Bike Adventure Tours", 774 | "rating": 4.8, 775 | "vicinity": "1825 Polk Street, San Francisco" 776 | }, 777 | { 778 | "geometry": { 779 | "location": { 780 | "lat": 37.76718199999999, 781 | "lng": -122.3986649 782 | }, 783 | "viewport": { 784 | "northeast": { 785 | "lat": 37.76864218029149, 786 | "lng": -122.3973635197085 787 | }, 788 | "southwest": { 789 | "lat": 37.76594421970849, 790 | "lng": -122.4000614802915 791 | } 792 | } 793 | }, 794 | "name": "ONYX Motorbikes", 795 | "rating": 4.1, 796 | "vicinity": "455 Irwin Street #104, San Francisco" 797 | }, 798 | { 799 | "geometry": { 800 | "location": { 801 | "lat": 37.671733, 802 | "lng": -122.472235 803 | }, 804 | "viewport": { 805 | "northeast": { 806 | "lat": 37.6729374802915, 807 | "lng": -122.4708094197085 808 | }, 809 | "southwest": { 810 | "lat": 37.6702395197085, 811 | "lng": -122.4735073802915 812 | } 813 | } 814 | }, 815 | "name": "DICK'S Sporting Goods", 816 | "rating": 3.7, 817 | "vicinity": "64 Serramonte Center, Daly City" 818 | }, 819 | { 820 | "geometry": { 821 | "location": { 822 | "lat": 37.8006666, 823 | "lng": -122.4306629 824 | }, 825 | "viewport": { 826 | "northeast": { 827 | "lat": 37.8019794802915, 828 | "lng": -122.4293067697085 829 | }, 830 | "southwest": { 831 | "lat": 37.7992815197085, 832 | "lng": -122.4320047302915 833 | } 834 | } 835 | }, 836 | "name": "Bike & View San Francisco Bike Rentals & Tours", 837 | "rating": 4, 838 | "vicinity": "1772 Lombard Street, San Francisco" 839 | }, 840 | { 841 | "geometry": { 842 | "location": { 843 | "lat": 37.7753428, 844 | "lng": -122.5024594 845 | }, 846 | "viewport": { 847 | "northeast": { 848 | "lat": 37.7767649302915, 849 | "lng": -122.5011157697085 850 | }, 851 | "southwest": { 852 | "lat": 37.77406696970851, 853 | "lng": -122.5038137302915 854 | } 855 | } 856 | }, 857 | "name": "DD Cycles", 858 | "rating": 4.8, 859 | "vicinity": "4049 Balboa Street, San Francisco" 860 | }, 861 | { 862 | "geometry": { 863 | "location": { 864 | "lat": 37.7612408, 865 | "lng": -122.4906782 866 | }, 867 | "viewport": { 868 | "northeast": { 869 | "lat": 37.76252048029149, 870 | "lng": -122.4893174697085 871 | }, 872 | "southwest": { 873 | "lat": 37.75982251970849, 874 | "lng": -122.4920154302915 875 | } 876 | } 877 | }, 878 | "name": "Elevation Bike Co.", 879 | "rating": 4.9, 880 | "vicinity": "2648 Judah Street, San Francisco" 881 | }, 882 | { 883 | "geometry": { 884 | "location": { 885 | "lat": 37.75704030000001, 886 | "lng": -122.4162458 887 | }, 888 | "viewport": { 889 | "northeast": { 890 | "lat": 37.75847083029151, 891 | "lng": -122.4149042197085 892 | }, 893 | "southwest": { 894 | "lat": 37.75577286970851, 895 | "lng": -122.4176021802915 896 | } 897 | } 898 | }, 899 | "name": "Pedal Revolution", 900 | "rating": 4.3, 901 | "vicinity": "3085 21st Street, San Francisco" 902 | }, 903 | { 904 | "geometry": { 905 | "location": { 906 | "lat": 37.782888, 907 | "lng": -122.418624 908 | }, 909 | "viewport": { 910 | "northeast": { 911 | "lat": 37.7843781802915, 912 | "lng": -122.4173040197085 913 | }, 914 | "southwest": { 915 | "lat": 37.7816802197085, 916 | "lng": -122.4200019802915 917 | } 918 | } 919 | }, 920 | "name": "Baygame", 921 | "rating": 5, 922 | "vicinity": "665 Eddy Street a, San Francisco" 923 | }, 924 | { 925 | "geometry": { 926 | "location": { 927 | "lat": 37.7620023, 928 | "lng": -122.4097674 929 | }, 930 | "viewport": { 931 | "northeast": { 932 | "lat": 37.7633391302915, 933 | "lng": -122.4086160697085 934 | }, 935 | "southwest": { 936 | "lat": 37.7606411697085, 937 | "lng": -122.4113140302915 938 | } 939 | } 940 | }, 941 | "name": "Scarab Cycles", 942 | "vicinity": "1999 Bryant Street, San Francisco" 943 | }, 944 | { 945 | "geometry": { 946 | "location": { 947 | "lat": 37.7995299, 948 | "lng": -122.4369355 949 | }, 950 | "viewport": { 951 | "northeast": { 952 | "lat": 37.8009556802915, 953 | "lng": -122.4356269197085 954 | }, 955 | "southwest": { 956 | "lat": 37.7982577197085, 957 | "lng": -122.4383248802915 958 | } 959 | } 960 | }, 961 | "name": "Golden Gate Bridge Bike Rentals", 962 | "rating": 4.6, 963 | "vicinity": "2157 Lombard Street, San Francisco" 964 | }, 965 | { 966 | "geometry": { 967 | "location": { 968 | "lat": 37.8052826, 969 | "lng": -122.4155004 970 | }, 971 | "viewport": { 972 | "northeast": { 973 | "lat": 37.80664093029151, 974 | "lng": -122.4143814697085 975 | }, 976 | "southwest": { 977 | "lat": 37.80394296970851, 978 | "lng": -122.4170794302915 979 | } 980 | } 981 | }, 982 | "name": "Fiets ophalen", 983 | "vicinity": "501 Bay Street, San Francisco" 984 | }, 985 | { 986 | "geometry": { 987 | "location": { 988 | "lat": 37.7703718, 989 | "lng": -122.3871247 990 | }, 991 | "viewport": { 992 | "northeast": { 993 | "lat": 37.7717082302915, 994 | "lng": -122.3860882697085 995 | }, 996 | "southwest": { 997 | "lat": 37.7690102697085, 998 | "lng": -122.3887862302915 999 | } 1000 | } 1001 | }, 1002 | "name": "Gling Urban Bikes", 1003 | "vicinity": "500 Terry A Francois Boulevard, San Francisco" 1004 | }, 1005 | { 1006 | "geometry": { 1007 | "location": { 1008 | "lat": 37.7256997, 1009 | "lng": -122.3841294 1010 | }, 1011 | "viewport": { 1012 | "northeast": { 1013 | "lat": 37.7270678302915, 1014 | "lng": -122.3828236197085 1015 | }, 1016 | "southwest": { 1017 | "lat": 37.7243698697085, 1018 | "lng": -122.3855215802915 1019 | } 1020 | } 1021 | }, 1022 | "name": "NTP", 1023 | "rating": 5, 1024 | "vicinity": "1699 Hawes Street, San Francisco" 1025 | } 1026 | ] 1027 | -------------------------------------------------------------------------------- /solution/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #6200EE 20 | #556200EE 21 | #3700B3 22 | #03DAC5 23 | 24 | -------------------------------------------------------------------------------- /solution/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | BuildYourFirstMap 19 | 20 | -------------------------------------------------------------------------------- /solution/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /solution/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.5.30' 5 | repositories { 6 | google() 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:7.0.4' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1" 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | mavenCentral() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | -------------------------------------------------------------------------------- /solution/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /solution/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/solution/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /solution/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 30 10:52:04 PDT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip -------------------------------------------------------------------------------- /solution/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /solution/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /solution/local.properties.defaults: -------------------------------------------------------------------------------- 1 | GOOGLE_MAPS_API_KEY=YOUR_API_KEY 2 | -------------------------------------------------------------------------------- /solution/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='BuildYourFirstMap' 2 | include ':app' 3 | -------------------------------------------------------------------------------- /starter/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /starter/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | id 'kotlin-android-extensions' 5 | 6 | // Add secrets-gradle-plugin here 7 | } 8 | 9 | android { 10 | compileSdk 32 11 | buildToolsVersion "29.0.3" 12 | 13 | defaultConfig { 14 | applicationId "com.google.codelabs.buildyourfirstmap" 15 | minSdk 21 16 | targetSdk 32 17 | versionCode 1 18 | versionName "1.0" 19 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 20 | } 21 | 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | 29 | } 30 | 31 | dependencies { 32 | implementation fileTree(dir: 'libs', include: ['*.jar']) 33 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 34 | implementation 'androidx.appcompat:appcompat:1.4.1' 35 | implementation 'androidx.core:core-ktx:1.7.0' 36 | implementation 'com.google.code.gson:gson:2.8.6' 37 | 38 | // Dependency to include Maps SDK for Android 39 | implementation 'com.google.android.gms:play-services-maps:18.0.2' 40 | 41 | testImplementation 'junit:junit:4.13.2' 42 | } 43 | -------------------------------------------------------------------------------- /starter/app/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 | -------------------------------------------------------------------------------- /starter/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /starter/app/src/main/java/com/google/codelabs/buildyourfirstmap/BitmapHelper.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import android.content.Context 18 | import android.graphics.Bitmap 19 | import android.graphics.Canvas 20 | import android.util.Log 21 | import androidx.annotation.ColorInt 22 | import androidx.annotation.DrawableRes 23 | import androidx.core.content.res.ResourcesCompat 24 | import androidx.core.graphics.drawable.DrawableCompat 25 | import com.google.android.gms.maps.model.BitmapDescriptor 26 | import com.google.android.gms.maps.model.BitmapDescriptorFactory 27 | 28 | object BitmapHelper { 29 | /** 30 | * Demonstrates converting a [Drawable] to a [BitmapDescriptor], for use as a marker icon. 31 | * Taken from ApiDemos on GitHub: https://github.com/googlemaps/android-samples/blob/master/ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos/MarkerDemoActivity.kt 32 | */ 33 | fun vectorToBitmap(context: Context, @DrawableRes id: Int, @ColorInt color: Int): BitmapDescriptor { 34 | val vectorDrawable = ResourcesCompat.getDrawable(context.resources, id, null) 35 | if (vectorDrawable == null) { 36 | Log.e("BitmapHelper", "Resource not found") 37 | return BitmapDescriptorFactory.defaultMarker() 38 | } 39 | val bitmap = Bitmap.createBitmap( 40 | vectorDrawable.intrinsicWidth, 41 | vectorDrawable.intrinsicHeight, 42 | Bitmap.Config.ARGB_8888 43 | ) 44 | val canvas = Canvas(bitmap) 45 | vectorDrawable.setBounds(0, 0, canvas.width, canvas.height) 46 | DrawableCompat.setTint(vectorDrawable, color) 47 | vectorDrawable.draw(canvas) 48 | return BitmapDescriptorFactory.fromBitmap(bitmap) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /starter/app/src/main/java/com/google/codelabs/buildyourfirstmap/MainActivity.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap 16 | 17 | import androidx.appcompat.app.AppCompatActivity 18 | 19 | class MainActivity : AppCompatActivity() { 20 | } 21 | -------------------------------------------------------------------------------- /starter/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/Place.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import com.google.android.gms.maps.model.LatLng 18 | 19 | data class Place( 20 | val name: String, 21 | val latLng: LatLng, 22 | val address: String, 23 | val rating: Float 24 | ) 25 | -------------------------------------------------------------------------------- /starter/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlacesReader.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import android.content.Context 18 | import com.google.codelabs.buildyourfirstmap.R 19 | import com.google.gson.Gson 20 | import com.google.gson.reflect.TypeToken 21 | import java.io.InputStream 22 | import java.io.InputStreamReader 23 | 24 | class PlacesReader(private val context: Context) { 25 | 26 | private val gson = Gson() 27 | 28 | private val inputStream: InputStream 29 | get() = context.resources.openRawResource(R.raw.places) 30 | 31 | fun read(): List { 32 | val itemType = object : TypeToken>() {}.type 33 | val reader = InputStreamReader(inputStream) 34 | return gson.fromJson>(reader, itemType).map { 35 | it.toPlace() 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /starter/app/src/main/java/com/google/codelabs/buildyourfirstmap/place/PlacesResponse.kt: -------------------------------------------------------------------------------- 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 | package com.google.codelabs.buildyourfirstmap.place 16 | 17 | import com.google.android.gms.maps.model.LatLng 18 | 19 | data class PlaceResponse( 20 | val geometry: Geometry, 21 | val name: String, 22 | val vicinity: String, 23 | val rating: Float 24 | ) { 25 | 26 | data class Geometry( 27 | val location: GeometryLocation 28 | ) 29 | 30 | data class GeometryLocation( 31 | val lat: Double, 32 | val lng: Double 33 | ) 34 | } 35 | 36 | fun PlaceResponse.toPlace(): Place = Place( 37 | name = name, 38 | latLng = LatLng(geometry.location.lat, geometry.location.lng), 39 | address = vicinity, 40 | rating = rating 41 | ) 42 | -------------------------------------------------------------------------------- /starter/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 25 | 31 | 34 | 37 | 38 | 39 | 40 | 46 | -------------------------------------------------------------------------------- /starter/app/src/main/res/drawable/ic_directions_bike_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /starter/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 176 | 181 | 186 | 187 | -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /starter/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /starter/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #6200EE 20 | #556200EE 21 | #3700B3 22 | #03DAC5 23 | 24 | -------------------------------------------------------------------------------- /starter/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | BuildYourFirstMap 19 | 20 | -------------------------------------------------------------------------------- /starter/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /starter/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.5.30' 5 | repositories { 6 | google() 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:7.0.4' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } 25 | -------------------------------------------------------------------------------- /starter/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /starter/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googlemaps-samples/codelab-maps-platform-101-android-kotlin/d31100c34be2819778af8ac77f3ad961f724cf93/starter/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /starter/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 30 10:51:12 PDT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip -------------------------------------------------------------------------------- /starter/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /starter/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /starter/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='BuildYourFirstMap' 2 | include ':app' 3 | --------------------------------------------------------------------------------