From fae3b5b9b0962611205033b6efb6cb0b9819c2f9 Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:30:34 -0700 Subject: [PATCH 01/11] chore: update WearOS readme --- WearOS/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/WearOS/README.md b/WearOS/README.md index 90ba39dd5..8474d9eb0 100644 --- a/WearOS/README.md +++ b/WearOS/README.md @@ -1,7 +1,7 @@ Wear OS Sample =================================== -This sample uses the [Google Maps Android API v2](https://developers.google.com/maps/documentation/android/) +This sample uses the [Google Maps SDK for Android](https://developers.google.com/maps/documentation/android-sdk/wear) to display a map on Wear OS. It shows the basic setup required for a gradle-based Android Studio project that [supports ambient mode](https://developer.android.com/training/wearables/apps/always-on.html). @@ -21,14 +21,20 @@ First download the samples by cloning this repository or downloading an archived snapshot. (See the options at the top of the page.) In Android Studio, use the "Import non-Android Studio project" or -"Import Project" option. Next select the ApiDemos/ directory that you downloaded +"Import Project" option. Next select the `WearOS/` directory that you downloaded from this repository. If prompted for a gradle configuration accept the default settings. Alternatively use the "gradlew build" command to build the project directly. -Add your API key to the `local.properties` file and call it `GOOGLE_MAPS_API_KEY`. -See the [quick guide to getting an API key](https://developers.google.com/maps/documentation/android-api/signup). +Open the `secrets.properties` file in your top-level directory, and then add the following code. Replace YOUR_API_KEY with your API key. Store your key in this file because secrets.properties is excluded from being checked into a version control system. +If the `secrets.properties` file does not exist, create it in the same folder as the `local.properties` file. + +``` +MAPS_API_KEY=YOUR_API_KEY +``` + +See the [guide for adding an API key to your project](https://developers.google.com/maps/documentation/android-sdk/config#step_3_add_your_api_key_to_the_project). Support ------- @@ -49,4 +55,4 @@ CONTRIBUTING.md. License ------- -Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo. \ No newline at end of file +Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo. From 0f4e369e1e973338a882732486992159346a3207 Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:44:03 -0700 Subject: [PATCH 02/11] chore: update WearOS AGP version --- WearOS/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WearOS/build.gradle b/WearOS/build.gradle index 4d0c71487..a4ad22378 100644 --- a/WearOS/build.gradle +++ b/WearOS/build.gradle @@ -15,7 +15,7 @@ */ plugins { - id 'com.android.application' version '8.5.0' apply false + id 'com.android.application' version '8.5.2' apply false id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false id 'org.jetbrains.kotlin.android' version '2.0.0' apply false -} \ No newline at end of file +} From 14b727f443667ce6f4f06fdc63a3a98a081384fb Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:45:00 -0700 Subject: [PATCH 03/11] chore: remove outdated API key instructions --- README.md | 4 ++-- WearOS/README.md | 3 ++- docs/GET_AN_API_KEY.md | 8 -------- tutorials/java/CurrentPlaceDetailsOnMap/README.md | 2 +- tutorials/java/MapWithMarker/README.md | 4 ++-- tutorials/java/Polygons/README.md | 2 +- tutorials/java/StyledMap/README.md | 2 +- tutorials/kotlin/CurrentPlaceDetailsOnMap/README.md | 2 +- tutorials/kotlin/MapWithMarker/README.md | 4 ++-- tutorials/kotlin/Polygons/README.md | 2 +- 10 files changed, 13 insertions(+), 20 deletions(-) delete mode 100644 docs/GET_AN_API_KEY.md diff --git a/README.md b/README.md index 99d703762..408d78e07 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![GitHub contributors](https://img.shields.io/github/contributors/googlemaps/android-samples) -![Apache-2.0](https://img.shields.io/badge/license-Apache-blue) +![Apache-2.0](https://img.shields.io/badge/license-Apache-blue) [![Build demos](https://github.com/googlemaps/android-samples/workflows/Build%20demos/badge.svg)](https://github.com/googlemaps/android-samples/actions?query=workflow%3A%22Build+demos%22) [![Discord](https://img.shields.io/discord/676948200904589322)](https://discord.gg/hYsWbmk) @@ -27,7 +27,7 @@ Pre-requisites * See each sample for pre-requisites. * All require up-to-date versions of the Android build tools and the Android support repository. -* The demo apps require that you add your own Google Maps API key. See [Get an API Key](docs/GET_AN_API_KEY.md) docs for more instructions. +* The demo apps require that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) docs for more instructions. Getting Started --------------- diff --git a/WearOS/README.md b/WearOS/README.md index 8474d9eb0..53567021f 100644 --- a/WearOS/README.md +++ b/WearOS/README.md @@ -27,6 +27,8 @@ If prompted for a gradle configuration accept the default settings. Alternatively use the "gradlew build" command to build the project directly. +See the [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) guide to get an API key. + Open the `secrets.properties` file in your top-level directory, and then add the following code. Replace YOUR_API_KEY with your API key. Store your key in this file because secrets.properties is excluded from being checked into a version control system. If the `secrets.properties` file does not exist, create it in the same folder as the `local.properties` file. @@ -34,7 +36,6 @@ If the `secrets.properties` file does not exist, create it in the same folder as MAPS_API_KEY=YOUR_API_KEY ``` -See the [guide for adding an API key to your project](https://developers.google.com/maps/documentation/android-sdk/config#step_3_add_your_api_key_to_the_project). Support ------- diff --git a/docs/GET_AN_API_KEY.md b/docs/GET_AN_API_KEY.md deleted file mode 100644 index 835776196..000000000 --- a/docs/GET_AN_API_KEY.md +++ /dev/null @@ -1,8 +0,0 @@ -# Getting an API Key - -The demos found in this repository require an API key. To create and use an API key: - - 1. [Get a Maps API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) - 1. Open the file in the root directory of the sample called `local.properties` (by default, this file is **NOT** under version control) - 1. Add a single line to `local.properties` that looks like `MAPS_API_KEY=YOUR_API_KEY`, where `YOUR_API_KEY` is the API key you obtained in the first step - 1. Build and run diff --git a/tutorials/java/CurrentPlaceDetailsOnMap/README.md b/tutorials/java/CurrentPlaceDetailsOnMap/README.md index 06d6d0a36..32e0f6cae 100644 --- a/tutorials/java/CurrentPlaceDetailsOnMap/README.md +++ b/tutorials/java/CurrentPlaceDetailsOnMap/README.md @@ -26,7 +26,7 @@ This sample uses the Gradle build system. 1. If prompted for a gradle configuration, accept the default settings. Alternatively use the `gradlew build` command to build the project directly. -This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions. +This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions. Support ------- diff --git a/tutorials/java/MapWithMarker/README.md b/tutorials/java/MapWithMarker/README.md index 2d3ea96a0..b3a58ab63 100644 --- a/tutorials/java/MapWithMarker/README.md +++ b/tutorials/java/MapWithMarker/README.md @@ -19,12 +19,12 @@ This sample uses the Gradle build system. 1. Download the samples by cloning this repository or downloading an archived snapshot. (See the options at the top of the page.) -1. In Android Studio, use "Open an existing Android Studio project". Next select the +1. In Android Studio, use "Open an existing Android Studio project". Next select the `tutorials/java/MapWithMarker` directory that you downloaded 1. If prompted for a gradle configuration, accept the default settings. Alternatively use the `gradlew build` command to build the project directly. -This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions. +This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions. Support ------- diff --git a/tutorials/java/Polygons/README.md b/tutorials/java/Polygons/README.md index 2b96b3edd..058e85d32 100644 --- a/tutorials/java/Polygons/README.md +++ b/tutorials/java/Polygons/README.md @@ -23,7 +23,7 @@ This sample uses the Gradle build system. 1. If prompted for a gradle configuration, accept the default settings. Alternatively use the `gradlew build` command to build the project directly. -This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions. +This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions. Support ------- diff --git a/tutorials/java/StyledMap/README.md b/tutorials/java/StyledMap/README.md index 49eb7859e..3a880f6c5 100644 --- a/tutorials/java/StyledMap/README.md +++ b/tutorials/java/StyledMap/README.md @@ -23,7 +23,7 @@ This sample uses the Gradle build system. 1. If prompted for a gradle configuration, accept the default settings. Alternatively use the "gradlew build" command to build the project directly. -This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions. +This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions. Support ------- diff --git a/tutorials/kotlin/CurrentPlaceDetailsOnMap/README.md b/tutorials/kotlin/CurrentPlaceDetailsOnMap/README.md index 364d51a53..6dc66cb20 100644 --- a/tutorials/kotlin/CurrentPlaceDetailsOnMap/README.md +++ b/tutorials/kotlin/CurrentPlaceDetailsOnMap/README.md @@ -23,7 +23,7 @@ This sample uses the Gradle build system. 1. If prompted for a gradle configuration, accept the default settings. Alternatively use the `gradlew build` command to build the project directly. -This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions. +This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions. Support ------- diff --git a/tutorials/kotlin/MapWithMarker/README.md b/tutorials/kotlin/MapWithMarker/README.md index 161237e64..17d985e53 100644 --- a/tutorials/kotlin/MapWithMarker/README.md +++ b/tutorials/kotlin/MapWithMarker/README.md @@ -20,12 +20,12 @@ This sample uses the Gradle build system. 1. Download the samples by cloning this repository or downloading an archived snapshot. (See the options at the top of the page.) -1. In Android Studio, use "Open an existing Android Studio project". Next select the +1. In Android Studio, use "Open an existing Android Studio project". Next select the `tutorials/kotlin/MapWithMarker` directory that you downloaded 1. If prompted for a gradle configuration, accept the default settings. Alternatively use the `gradlew build` command to build the project directly. -This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions. +This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions. Support ------- diff --git a/tutorials/kotlin/Polygons/README.md b/tutorials/kotlin/Polygons/README.md index 2b96b3edd..058e85d32 100644 --- a/tutorials/kotlin/Polygons/README.md +++ b/tutorials/kotlin/Polygons/README.md @@ -23,7 +23,7 @@ This sample uses the Gradle build system. 1. If prompted for a gradle configuration, accept the default settings. Alternatively use the `gradlew build` command to build the project directly. -This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions. +This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions. Support ------- From 310d8334f12d7de386a30c32c9023dcda5338334 Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:01:10 -0700 Subject: [PATCH 04/11] chore: update comments in build.gradle --- ApiDemos/java/app/build.gradle | 8 +++++--- ApiDemos/kotlin/app/build.gradle | 6 ++++-- snippets/app-compose/build.gradle | 8 +++++--- snippets/app-ktx/build.gradle | 8 +++++--- snippets/app-places-ktx/build.gradle | 6 ++++-- snippets/app-rx/build.gradle | 8 +++++--- snippets/app-utils-ktx/build.gradle | 8 +++++--- snippets/app-utils/build.gradle | 8 +++++--- snippets/app/build.gradle | 6 ++++-- 9 files changed, 42 insertions(+), 24 deletions(-) diff --git a/ApiDemos/java/app/build.gradle b/ApiDemos/java/app/build.gradle index 3e589fac8..f822a8829 100644 --- a/ApiDemos/java/app/build.gradle +++ b/ApiDemos/java/app/build.gradle @@ -57,11 +57,13 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be // checked in version control. defaultPropertiesFileName = "local.defaults.properties" -} \ No newline at end of file +} diff --git a/ApiDemos/kotlin/app/build.gradle b/ApiDemos/kotlin/app/build.gradle index e2254dca1..dd861f446 100644 --- a/ApiDemos/kotlin/app/build.gradle +++ b/ApiDemos/kotlin/app/build.gradle @@ -71,8 +71,10 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be diff --git a/snippets/app-compose/build.gradle b/snippets/app-compose/build.gradle index 333e2ae1b..399cfa585 100644 --- a/snippets/app-compose/build.gradle +++ b/snippets/app-compose/build.gradle @@ -63,11 +63,13 @@ dependencies { // [END maps_android_compose_dependency] secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be // checked in version control. defaultPropertiesFileName = 'local.defaults.properties' -} \ No newline at end of file +} diff --git a/snippets/app-ktx/build.gradle b/snippets/app-ktx/build.gradle index 95feed4ce..04e152758 100644 --- a/snippets/app-ktx/build.gradle +++ b/snippets/app-ktx/build.gradle @@ -54,11 +54,13 @@ dependencies { // [END maps_android_ktx_install_snippet] secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be // checked in version control. defaultPropertiesFileName = 'local.defaults.properties' -} \ No newline at end of file +} diff --git a/snippets/app-places-ktx/build.gradle b/snippets/app-places-ktx/build.gradle index d7fb8f586..9cc0d8e13 100644 --- a/snippets/app-places-ktx/build.gradle +++ b/snippets/app-places-ktx/build.gradle @@ -54,8 +54,10 @@ dependencies { // [END places_android_ktx_install_snippet] secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be diff --git a/snippets/app-rx/build.gradle b/snippets/app-rx/build.gradle index 480c14991..7dc1c3fe4 100644 --- a/snippets/app-rx/build.gradle +++ b/snippets/app-rx/build.gradle @@ -63,11 +63,13 @@ dependencies { // [END maps_android_maps_rx_install] secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be // checked in version control. defaultPropertiesFileName = 'local.defaults.properties' -} \ No newline at end of file +} diff --git a/snippets/app-utils-ktx/build.gradle b/snippets/app-utils-ktx/build.gradle index ffd133252..04c4cbd8f 100644 --- a/snippets/app-utils-ktx/build.gradle +++ b/snippets/app-utils-ktx/build.gradle @@ -52,11 +52,13 @@ dependencies { // [END maps_android_utils_ktx_install_snippet] secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be // checked in version control. defaultPropertiesFileName = 'local.defaults.properties' -} \ No newline at end of file +} diff --git a/snippets/app-utils/build.gradle b/snippets/app-utils/build.gradle index 1412e44db..0dde33254 100644 --- a/snippets/app-utils/build.gradle +++ b/snippets/app-utils/build.gradle @@ -57,11 +57,13 @@ dependencies { // [END maps_android_utils_install_snippet] secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be // checked in version control. defaultPropertiesFileName = 'local.defaults.properties' -} \ No newline at end of file +} diff --git a/snippets/app/build.gradle b/snippets/app/build.gradle index a96740273..393696c8d 100644 --- a/snippets/app/build.gradle +++ b/snippets/app/build.gradle @@ -71,8 +71,10 @@ dependencies { // [START maps_android_secrets_gradle_plugin_config] secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be From 1ace0a6d4354d96e8122603e7441dadbde2cd46a Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:33:28 -0700 Subject: [PATCH 05/11] chore: update build.gradle comments for adding an API key --- tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle | 6 ++++-- tutorials/java/MapWithMarker/app/build.gradle | 6 ++++-- tutorials/java/Polygons/app/build.gradle | 6 ++++-- tutorials/java/StyledMap/app/build.gradle | 8 +++++--- .../kotlin/CurrentPlaceDetailsOnMap/app/build.gradle | 6 ++++-- tutorials/kotlin/MapWithMarker/app/build.gradle | 8 +++++--- tutorials/kotlin/Polygons/app/build.gradle | 6 ++++-- 7 files changed, 30 insertions(+), 16 deletions(-) diff --git a/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle b/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle index cadc32bf4..636cdf01b 100644 --- a/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle +++ b/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle @@ -37,8 +37,10 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be diff --git a/tutorials/java/MapWithMarker/app/build.gradle b/tutorials/java/MapWithMarker/app/build.gradle index 012017a53..ed548f0f6 100644 --- a/tutorials/java/MapWithMarker/app/build.gradle +++ b/tutorials/java/MapWithMarker/app/build.gradle @@ -35,8 +35,10 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // To add your Maps API key to this project: diff --git a/tutorials/java/Polygons/app/build.gradle b/tutorials/java/Polygons/app/build.gradle index 8ed67a127..e509a2ccd 100644 --- a/tutorials/java/Polygons/app/build.gradle +++ b/tutorials/java/Polygons/app/build.gradle @@ -35,8 +35,10 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // To add your Maps API key to this project: diff --git a/tutorials/java/StyledMap/app/build.gradle b/tutorials/java/StyledMap/app/build.gradle index 6ccc9f1de..1c99151d2 100644 --- a/tutorials/java/StyledMap/app/build.gradle +++ b/tutorials/java/StyledMap/app/build.gradle @@ -39,11 +39,13 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // A properties file containing default secret values. This file can be // checked in version control. defaultPropertiesFileName = 'local.defaults.properties' -} \ No newline at end of file +} diff --git a/tutorials/kotlin/CurrentPlaceDetailsOnMap/app/build.gradle b/tutorials/kotlin/CurrentPlaceDetailsOnMap/app/build.gradle index 11eaf1cd6..ac1048e46 100644 --- a/tutorials/kotlin/CurrentPlaceDetailsOnMap/app/build.gradle +++ b/tutorials/kotlin/CurrentPlaceDetailsOnMap/app/build.gradle @@ -48,8 +48,10 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // To add your Maps API key to this project: diff --git a/tutorials/kotlin/MapWithMarker/app/build.gradle b/tutorials/kotlin/MapWithMarker/app/build.gradle index 7ea9c3ded..68ba7e1bb 100644 --- a/tutorials/kotlin/MapWithMarker/app/build.gradle +++ b/tutorials/kotlin/MapWithMarker/app/build.gradle @@ -43,10 +43,12 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" - + // To add your Maps API key to this project: // 1. Open the root project's local.properties file // 2. Add this line, where YOUR_API_KEY is your API key: diff --git a/tutorials/kotlin/Polygons/app/build.gradle b/tutorials/kotlin/Polygons/app/build.gradle index 3d200a093..519b1dedd 100644 --- a/tutorials/kotlin/Polygons/app/build.gradle +++ b/tutorials/kotlin/Polygons/app/build.gradle @@ -41,8 +41,10 @@ dependencies { } secrets { - // Optionally specify a different file name containing your secrets. - // If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // To add your Maps API key to this project: + // 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. + // 2. Add this line, where YOUR_API_KEY is your API key: + // MAPS_API_KEY=YOUR_API_KEY propertiesFileName = "secrets.properties" // To add your Maps API key to this project: From ac0a18fd3d9edf7412d44baeb1dc437f04188839 Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:37:53 -0700 Subject: [PATCH 06/11] chore: update APIDemos folder comments --- .../java/app/src/main/AndroidManifest.xml | 2 +- .../com/example/mapdemo/MainActivity.java | 103 +++++++++--------- .../com/example/kotlindemos/MainActivity.kt | 2 +- .../kotlin/app/src/main/AndroidManifest.xml | 2 +- .../com/example/kotlindemos/MainActivity.kt | 2 +- 5 files changed, 55 insertions(+), 56 deletions(-) diff --git a/ApiDemos/java/app/src/main/AndroidManifest.xml b/ApiDemos/java/app/src/main/AndroidManifest.xml index 87e29a0ad..fea81dd24 100644 --- a/ApiDemos/java/app/src/main/AndroidManifest.xml +++ b/ApiDemos/java/app/src/main/AndroidManifest.xml @@ -41,7 +41,7 @@ diff --git a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java index e308c30f2..98fb0255f 100644 --- a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java +++ b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - package com.example.mapdemo; import android.content.Context; @@ -26,73 +25,73 @@ import android.widget.ListAdapter; import android.widget.ListView; import android.widget.Toast; - import androidx.appcompat.app.AppCompatActivity; /** * The main activity of the API library demo gallery. - *

- * The main layout lists the demonstrated features, with buttons to launch them. + * + *

The main layout lists the demonstrated features, with buttons to launch them. */ public final class MainActivity extends AppCompatActivity - implements AdapterView.OnItemClickListener { + implements AdapterView.OnItemClickListener { + /** A custom array adapter that shows a {@link FeatureView} containing details about the demo. */ + private static class CustomArrayAdapter extends ArrayAdapter { /** - * A custom array adapter that shows a {@link FeatureView} containing details about the demo. + * @param demos An array containing the details of the demos to be displayed. */ - private static class CustomArrayAdapter extends ArrayAdapter { - - /** - * @param demos An array containing the details of the demos to be displayed. - */ - public CustomArrayAdapter(Context context, DemoDetails[] demos) { - super(context, R.layout.feature, R.id.title, demos); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - FeatureView featureView; - if (convertView instanceof FeatureView) { - featureView = (FeatureView) convertView; - } else { - featureView = new FeatureView(getContext()); - } - - DemoDetails demo = getItem(position); - - featureView.setTitleId(demo.titleId); - featureView.setDescriptionId(demo.descriptionId); - - Resources resources = getContext().getResources(); - String title = resources.getString(demo.titleId); - String description = resources.getString(demo.descriptionId); - featureView.setContentDescription(title + ". " + description); - - return featureView; - } + public CustomArrayAdapter(Context context, DemoDetails[] demos) { + super(context, R.layout.feature, R.id.title, demos); } @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - ListView list = findViewById(R.id.list); + public View getView(int position, View convertView, ViewGroup parent) { + FeatureView featureView; + if (convertView instanceof FeatureView) { + featureView = (FeatureView) convertView; + } else { + featureView = new FeatureView(getContext()); + } - ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); + DemoDetails demo = getItem(position); - list.setAdapter(adapter); - list.setOnItemClickListener(this); - list.setEmptyView(findViewById(R.id.empty)); + featureView.setTitleId(demo.titleId); + featureView.setDescriptionId(demo.descriptionId); - if (BuildConfig.MAPS_API_KEY.isEmpty()) { - Toast.makeText(this, "Add your own API key in local.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show(); - } - } + Resources resources = getContext().getResources(); + String title = resources.getString(demo.titleId); + String description = resources.getString(demo.descriptionId); + featureView.setContentDescription(title + ". " + description); - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); - startActivity(new Intent(this, demo.activityClass)); + return featureView; + } + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + ListView list = findViewById(R.id.list); + + ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); + + list.setAdapter(adapter); + list.setOnItemClickListener(this); + list.setEmptyView(findViewById(R.id.empty)); + + if (BuildConfig.MAPS_API_KEY.isEmpty()) { + Toast.makeText( + this, + "Add your own API key in secrets.properties as MAPS_API_KEY=YOUR_API_KEY", + Toast.LENGTH_LONG) + .show(); } + } + + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); + startActivity(new Intent(this, demo.activityClass)); + } } diff --git a/ApiDemos/kotlin/app/src/gms/java/com/example/kotlindemos/MainActivity.kt b/ApiDemos/kotlin/app/src/gms/java/com/example/kotlindemos/MainActivity.kt index 333c814c8..bd0257c5d 100644 --- a/ApiDemos/kotlin/app/src/gms/java/com/example/kotlindemos/MainActivity.kt +++ b/ApiDemos/kotlin/app/src/gms/java/com/example/kotlindemos/MainActivity.kt @@ -52,7 +52,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { } if (BuildConfig.MAPS_API_KEY.isEmpty()) { - Toast.makeText(this, "Add your own API key in local.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show() + Toast.makeText(this, "Add your own API key in secrets.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show() } } diff --git a/ApiDemos/kotlin/app/src/main/AndroidManifest.xml b/ApiDemos/kotlin/app/src/main/AndroidManifest.xml index ee42e89db..fede1a685 100644 --- a/ApiDemos/kotlin/app/src/main/AndroidManifest.xml +++ b/ApiDemos/kotlin/app/src/main/AndroidManifest.xml @@ -32,7 +32,7 @@ android:theme="@style/AppTheme"> diff --git a/ApiDemos/kotlin/app/src/v3/java/com/example/kotlindemos/MainActivity.kt b/ApiDemos/kotlin/app/src/v3/java/com/example/kotlindemos/MainActivity.kt index f65bc27ec..f11c51362 100644 --- a/ApiDemos/kotlin/app/src/v3/java/com/example/kotlindemos/MainActivity.kt +++ b/ApiDemos/kotlin/app/src/v3/java/com/example/kotlindemos/MainActivity.kt @@ -57,7 +57,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { } if (BuildConfig.MAPS_API_KEY.isEmpty()) { - Toast.makeText(this, "Add your own API key in local.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show() + Toast.makeText(this, "Add your own API key in secrets.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show() } } From bcc0397666a56d7336d25638ba13f06e56bda025 Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:55:54 -0700 Subject: [PATCH 07/11] chore: revert v3 MainActivity --- .../com/example/mapdemo/MainActivity.java | 103 +++++++++--------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java index 98fb0255f..e308c30f2 100644 --- a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java +++ b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + package com.example.mapdemo; import android.content.Context; @@ -25,73 +26,73 @@ import android.widget.ListAdapter; import android.widget.ListView; import android.widget.Toast; + import androidx.appcompat.app.AppCompatActivity; /** * The main activity of the API library demo gallery. - * - *

The main layout lists the demonstrated features, with buttons to launch them. + *

+ * The main layout lists the demonstrated features, with buttons to launch them. */ public final class MainActivity extends AppCompatActivity - implements AdapterView.OnItemClickListener { + implements AdapterView.OnItemClickListener { - /** A custom array adapter that shows a {@link FeatureView} containing details about the demo. */ - private static class CustomArrayAdapter extends ArrayAdapter { /** - * @param demos An array containing the details of the demos to be displayed. + * A custom array adapter that shows a {@link FeatureView} containing details about the demo. */ - public CustomArrayAdapter(Context context, DemoDetails[] demos) { - super(context, R.layout.feature, R.id.title, demos); - } + private static class CustomArrayAdapter extends ArrayAdapter { - @Override - public View getView(int position, View convertView, ViewGroup parent) { - FeatureView featureView; - if (convertView instanceof FeatureView) { - featureView = (FeatureView) convertView; - } else { - featureView = new FeatureView(getContext()); - } + /** + * @param demos An array containing the details of the demos to be displayed. + */ + public CustomArrayAdapter(Context context, DemoDetails[] demos) { + super(context, R.layout.feature, R.id.title, demos); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + FeatureView featureView; + if (convertView instanceof FeatureView) { + featureView = (FeatureView) convertView; + } else { + featureView = new FeatureView(getContext()); + } - DemoDetails demo = getItem(position); + DemoDetails demo = getItem(position); - featureView.setTitleId(demo.titleId); - featureView.setDescriptionId(demo.descriptionId); + featureView.setTitleId(demo.titleId); + featureView.setDescriptionId(demo.descriptionId); - Resources resources = getContext().getResources(); - String title = resources.getString(demo.titleId); - String description = resources.getString(demo.descriptionId); - featureView.setContentDescription(title + ". " + description); + Resources resources = getContext().getResources(); + String title = resources.getString(demo.titleId); + String description = resources.getString(demo.descriptionId); + featureView.setContentDescription(title + ". " + description); - return featureView; + return featureView; + } } - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - ListView list = findViewById(R.id.list); - - ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); - - list.setAdapter(adapter); - list.setOnItemClickListener(this); - list.setEmptyView(findViewById(R.id.empty)); - - if (BuildConfig.MAPS_API_KEY.isEmpty()) { - Toast.makeText( - this, - "Add your own API key in secrets.properties as MAPS_API_KEY=YOUR_API_KEY", - Toast.LENGTH_LONG) - .show(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + ListView list = findViewById(R.id.list); + + ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); + + list.setAdapter(adapter); + list.setOnItemClickListener(this); + list.setEmptyView(findViewById(R.id.empty)); + + if (BuildConfig.MAPS_API_KEY.isEmpty()) { + Toast.makeText(this, "Add your own API key in local.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show(); + } } - } - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); - startActivity(new Intent(this, demo.activityClass)); - } + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); + startActivity(new Intent(this, demo.activityClass)); + } } From c9ecff448c9604e4ffc579cb5aad51c7db2a98d1 Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:57:18 -0700 Subject: [PATCH 08/11] chore: update v3 MainActivity.java to secrets.properties --- .../com/example/mapdemo/MainActivity.java | 103 +++++++++--------- 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java index e308c30f2..98fb0255f 100644 --- a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java +++ b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - package com.example.mapdemo; import android.content.Context; @@ -26,73 +25,73 @@ import android.widget.ListAdapter; import android.widget.ListView; import android.widget.Toast; - import androidx.appcompat.app.AppCompatActivity; /** * The main activity of the API library demo gallery. - *

- * The main layout lists the demonstrated features, with buttons to launch them. + * + *

The main layout lists the demonstrated features, with buttons to launch them. */ public final class MainActivity extends AppCompatActivity - implements AdapterView.OnItemClickListener { + implements AdapterView.OnItemClickListener { + /** A custom array adapter that shows a {@link FeatureView} containing details about the demo. */ + private static class CustomArrayAdapter extends ArrayAdapter { /** - * A custom array adapter that shows a {@link FeatureView} containing details about the demo. + * @param demos An array containing the details of the demos to be displayed. */ - private static class CustomArrayAdapter extends ArrayAdapter { - - /** - * @param demos An array containing the details of the demos to be displayed. - */ - public CustomArrayAdapter(Context context, DemoDetails[] demos) { - super(context, R.layout.feature, R.id.title, demos); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - FeatureView featureView; - if (convertView instanceof FeatureView) { - featureView = (FeatureView) convertView; - } else { - featureView = new FeatureView(getContext()); - } - - DemoDetails demo = getItem(position); - - featureView.setTitleId(demo.titleId); - featureView.setDescriptionId(demo.descriptionId); - - Resources resources = getContext().getResources(); - String title = resources.getString(demo.titleId); - String description = resources.getString(demo.descriptionId); - featureView.setContentDescription(title + ". " + description); - - return featureView; - } + public CustomArrayAdapter(Context context, DemoDetails[] demos) { + super(context, R.layout.feature, R.id.title, demos); } @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - ListView list = findViewById(R.id.list); + public View getView(int position, View convertView, ViewGroup parent) { + FeatureView featureView; + if (convertView instanceof FeatureView) { + featureView = (FeatureView) convertView; + } else { + featureView = new FeatureView(getContext()); + } - ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); + DemoDetails demo = getItem(position); - list.setAdapter(adapter); - list.setOnItemClickListener(this); - list.setEmptyView(findViewById(R.id.empty)); + featureView.setTitleId(demo.titleId); + featureView.setDescriptionId(demo.descriptionId); - if (BuildConfig.MAPS_API_KEY.isEmpty()) { - Toast.makeText(this, "Add your own API key in local.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show(); - } - } + Resources resources = getContext().getResources(); + String title = resources.getString(demo.titleId); + String description = resources.getString(demo.descriptionId); + featureView.setContentDescription(title + ". " + description); - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); - startActivity(new Intent(this, demo.activityClass)); + return featureView; + } + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + ListView list = findViewById(R.id.list); + + ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); + + list.setAdapter(adapter); + list.setOnItemClickListener(this); + list.setEmptyView(findViewById(R.id.empty)); + + if (BuildConfig.MAPS_API_KEY.isEmpty()) { + Toast.makeText( + this, + "Add your own API key in secrets.properties as MAPS_API_KEY=YOUR_API_KEY", + Toast.LENGTH_LONG) + .show(); } + } + + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); + startActivity(new Intent(this, demo.activityClass)); + } } From b5779acb2a9255923b05552aebb175b3710453bb Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:00:16 -0700 Subject: [PATCH 09/11] Revert "chore: update v3 MainActivity.java to secrets.properties" This reverts commit c9ecff448c9604e4ffc579cb5aad51c7db2a98d1. --- .../com/example/mapdemo/MainActivity.java | 103 +++++++++--------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java index 98fb0255f..e308c30f2 100644 --- a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java +++ b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + package com.example.mapdemo; import android.content.Context; @@ -25,73 +26,73 @@ import android.widget.ListAdapter; import android.widget.ListView; import android.widget.Toast; + import androidx.appcompat.app.AppCompatActivity; /** * The main activity of the API library demo gallery. - * - *

The main layout lists the demonstrated features, with buttons to launch them. + *

+ * The main layout lists the demonstrated features, with buttons to launch them. */ public final class MainActivity extends AppCompatActivity - implements AdapterView.OnItemClickListener { + implements AdapterView.OnItemClickListener { - /** A custom array adapter that shows a {@link FeatureView} containing details about the demo. */ - private static class CustomArrayAdapter extends ArrayAdapter { /** - * @param demos An array containing the details of the demos to be displayed. + * A custom array adapter that shows a {@link FeatureView} containing details about the demo. */ - public CustomArrayAdapter(Context context, DemoDetails[] demos) { - super(context, R.layout.feature, R.id.title, demos); - } + private static class CustomArrayAdapter extends ArrayAdapter { - @Override - public View getView(int position, View convertView, ViewGroup parent) { - FeatureView featureView; - if (convertView instanceof FeatureView) { - featureView = (FeatureView) convertView; - } else { - featureView = new FeatureView(getContext()); - } + /** + * @param demos An array containing the details of the demos to be displayed. + */ + public CustomArrayAdapter(Context context, DemoDetails[] demos) { + super(context, R.layout.feature, R.id.title, demos); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + FeatureView featureView; + if (convertView instanceof FeatureView) { + featureView = (FeatureView) convertView; + } else { + featureView = new FeatureView(getContext()); + } - DemoDetails demo = getItem(position); + DemoDetails demo = getItem(position); - featureView.setTitleId(demo.titleId); - featureView.setDescriptionId(demo.descriptionId); + featureView.setTitleId(demo.titleId); + featureView.setDescriptionId(demo.descriptionId); - Resources resources = getContext().getResources(); - String title = resources.getString(demo.titleId); - String description = resources.getString(demo.descriptionId); - featureView.setContentDescription(title + ". " + description); + Resources resources = getContext().getResources(); + String title = resources.getString(demo.titleId); + String description = resources.getString(demo.descriptionId); + featureView.setContentDescription(title + ". " + description); - return featureView; + return featureView; + } } - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - ListView list = findViewById(R.id.list); - - ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); - - list.setAdapter(adapter); - list.setOnItemClickListener(this); - list.setEmptyView(findViewById(R.id.empty)); - - if (BuildConfig.MAPS_API_KEY.isEmpty()) { - Toast.makeText( - this, - "Add your own API key in secrets.properties as MAPS_API_KEY=YOUR_API_KEY", - Toast.LENGTH_LONG) - .show(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + ListView list = findViewById(R.id.list); + + ListAdapter adapter = new CustomArrayAdapter(this, DemoDetailsList.DEMOS); + + list.setAdapter(adapter); + list.setOnItemClickListener(this); + list.setEmptyView(findViewById(R.id.empty)); + + if (BuildConfig.MAPS_API_KEY.isEmpty()) { + Toast.makeText(this, "Add your own API key in local.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show(); + } } - } - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); - startActivity(new Intent(this, demo.activityClass)); - } + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + DemoDetails demo = (DemoDetails) parent.getAdapter().getItem(position); + startActivity(new Intent(this, demo.activityClass)); + } } From 9b527a9c3783e8c5e12af47627fb29c27b2e800a Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:03:13 -0700 Subject: [PATCH 10/11] chore: update Toast message in v3 MainActivity.java --- .../java/app/src/v3/java/com/example/mapdemo/MainActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java index e308c30f2..ad79897f1 100644 --- a/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java +++ b/ApiDemos/java/app/src/v3/java/com/example/mapdemo/MainActivity.java @@ -86,7 +86,7 @@ protected void onCreate(Bundle savedInstanceState) { list.setEmptyView(findViewById(R.id.empty)); if (BuildConfig.MAPS_API_KEY.isEmpty()) { - Toast.makeText(this, "Add your own API key in local.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show(); + Toast.makeText(this, "Add your own API key in secrets.properties as MAPS_API_KEY=YOUR_API_KEY", Toast.LENGTH_LONG).show(); } } From 732dccd7af525154deb3a10ad10161257c2b175a Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:15:41 -0700 Subject: [PATCH 11/11] chore: update license header --- .../java/app/src/main/AndroidManifest.xml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ApiDemos/java/app/src/main/AndroidManifest.xml b/ApiDemos/java/app/src/main/AndroidManifest.xml index fea81dd24..92fb8dc4f 100644 --- a/ApiDemos/java/app/src/main/AndroidManifest.xml +++ b/ApiDemos/java/app/src/main/AndroidManifest.xml @@ -1,18 +1,18 @@