From f4654e60a2d7946411fe74bc5131b5a723e10a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20L=C3=B3pez=20Ma=C3=B1as?= Date: Fri, 14 Feb 2025 07:37:43 +0900 Subject: [PATCH] feat: Data-Driven styling samples (#1771) * fix: import rememberMarkerState and use the marker state correctly * feat: dataset styling Kotlin samples * feat: added DataDrivenBoundariesActivity.kt * feat: added DataDrivenBoundariesActivity * feat: added documentation * feat: added header * chore: changed MY_MAP_ID to DEMO_MAP_ID * feat: moved data files to raw * feat: added DataDrivenBoundariesActivity * feat: removed unused files * feat: map id * chore: replace System.out.println with Log.d * feat: added region tags * feat: added different set of DDS * feat: added different set of DDS * feat: replacing files feat: replacing files * feat: replacing files * feat: compileSdk 35 * feat: compileSdk 35 * chore: updated README file * feat: trying to force different datasets * feat: updated samples * feat: Add data-driven styling for datasets This commit introduces data-driven styling for datasets in the ApiDemos application. The following changes were made: Added a custom Application class (ApiDemoApplication) to check for the presence and validity of the API key during startup. Added a new data structure (DataSet) to hold information about each dataset, including its label, dataset ID, location, and styling callback. Updated the DataDrivenDatasetStylingActivity to use the new data structure and styling callbacks. Rename the dataset input files to better reflect there contents. * fix: moves the dataset ids to the secrets.properties file * feat: significant rewrite to of DataDrivenDatasetStylingActivity * Makes the app look better on full screen with a cutout * Uses material elements * Switch to using secrets for the data set ids * more of a convenience to prevent having to remove the ids when submitting * moves dataset data files to common area since they are not used directly by the app * Detailed instructions for uploading the data to console (WIP) * fix: exports the data driven styling activities so they can be run directly * feat: added header * feat: change ubuntu-latest * feat: change ubuntu-latest * feat: change ubuntu-latest --------- Co-authored-by: dkhawk <107309+dkhawk@users.noreply.github.com> --- .github/workflows/build.yml | 8 +- ApiDemos/java/app/build.gradle.kts | 2 +- .../java/app/src/main/AndroidManifest.xml | 11 +- .../example/mapdemo/ApiDemoApplication.java | 78 ++++ .../mapdemo/DataDrivenBoundariesActivity.java | 228 +++++++++++ .../DataDrivenDatasetStylingActivity.java | 367 ++++++++++++++++++ .../com/example/mapdemo/DemoDetailsList.java | 6 + .../mapdemo/MapColorSchemeActivity.java | 2 +- .../app/src/main/res/layout/basic_demo.xml | 2 +- .../main/res/layout/camera_clamping_demo.xml | 2 +- .../app/src/main/res/layout/camera_demo.xml | 2 +- .../app/src/main/res/layout/circle_demo.xml | 2 +- .../res/layout/cloud_styling_basic_demo.xml | 2 +- .../main/res/layout/custom_info_contents.xml | 2 +- .../main/res/layout/custom_info_window.xml | 2 +- .../layout/data_driven_boundaries_demo.xml | 53 +++ .../res/layout/data_driven_styling_demo.xml | 59 +++ .../app/src/main/res/layout/events_demo.xml | 2 +- .../java/app/src/main/res/layout/feature.xml | 2 +- .../main/res/layout/ground_overlay_demo.xml | 2 +- .../app/src/main/res/layout/indoor_demo.xml | 2 +- .../app/src/main/res/layout/layers_demo.xml | 2 +- .../app/src/main/res/layout/legal_info.xml | 2 +- .../app/src/main/res/layout/lite_demo.xml | 2 +- .../main/res/layout/map_color_scheme_demo.xml | 2 +- .../src/main/res/layout/map_in_pager_demo.xml | 2 +- ...marker_close_info_window_on_retap_demo.xml | 2 +- .../app/src/main/res/layout/marker_demo.xml | 2 +- .../app/src/main/res/layout/multimap_demo.xml | 2 +- .../src/main/res/layout/my_location_demo.xml | 2 +- .../app/src/main/res/layout/options_demo.xml | 2 +- .../app/src/main/res/layout/polygon_demo.xml | 2 +- .../app/src/main/res/layout/polyline_demo.xml | 2 +- .../src/main/res/layout/raw_mapview_demo.xml | 2 +- .../src/main/res/layout/save_state_demo.xml | 2 +- .../app/src/main/res/layout/snapshot_demo.xml | 2 +- ...plit_street_view_panorama_and_map_demo.xml | 2 +- .../street_view_panorama_basic_demo.xml | 2 +- .../street_view_panorama_events_demo.xml | 2 +- .../street_view_panorama_navigation_demo.xml | 2 +- .../street_view_panorama_options_demo.xml | 2 +- .../layout/street_view_panorama_view_demo.xml | 2 +- .../app/src/main/res/layout/tags_demo.xml | 2 +- .../app/src/main/res/layout/text_fragment.xml | 2 +- .../main/res/layout/tile_coordinate_demo.xml | 2 +- .../src/main/res/layout/tile_overlay_demo.xml | 2 +- .../src/main/res/layout/ui_settings_demo.xml | 2 +- .../main/res/layout/visible_region_demo.xml | 2 +- .../java/app/src/main/res/values/strings.xml | 10 +- .../java/app/src/v3/res/layout/basic_demo.xml | 2 +- .../app/src/v3/res/layout/camera_demo.xml | 2 +- .../app/src/v3/res/layout/circle_demo.xml | 2 +- .../v3/res/layout/custom_info_contents.xml | 2 +- .../src/v3/res/layout/custom_info_window.xml | 2 +- .../app/src/v3/res/layout/events_demo.xml | 2 +- .../java/app/src/v3/res/layout/feature.xml | 2 +- .../src/v3/res/layout/ground_overlay_demo.xml | 2 +- .../app/src/v3/res/layout/indoor_demo.xml | 2 +- .../app/src/v3/res/layout/layers_demo.xml | 2 +- .../java/app/src/v3/res/layout/legal_info.xml | 2 +- .../java/app/src/v3/res/layout/lite_demo.xml | 2 +- ApiDemos/java/app/src/v3/res/layout/main.xml | 2 +- .../src/v3/res/layout/map_in_pager_demo.xml | 2 +- .../app/src/v3/res/layout/marker_demo.xml | 2 +- .../app/src/v3/res/layout/multimap_demo.xml | 2 +- .../src/v3/res/layout/my_location_demo.xml | 2 +- .../app/src/v3/res/layout/options_demo.xml | 2 +- .../app/src/v3/res/layout/polygon_demo.xml | 2 +- .../src/v3/res/layout/raw_mapview_demo.xml | 2 +- .../app/src/v3/res/layout/save_state_demo.xml | 2 +- ...plit_street_view_panorama_and_map_demo.xml | 2 +- .../street_view_panorama_basic_demo.xml | 2 +- .../street_view_panorama_events_demo.xml | 2 +- .../street_view_panorama_navigation_demo.xml | 2 +- .../street_view_panorama_options_demo.xml | 2 +- .../layout/street_view_panorama_view_demo.xml | 2 +- .../v3/res/layout/tile_coordinate_demo.xml | 2 +- .../src/v3/res/layout/tile_overlay_demo.xml | 2 +- .../src/v3/res/layout/ui_settings_demo.xml | 2 +- .../src/v3/res/layout/visible_region_demo.xml | 2 +- ApiDemos/java/build.gradle.kts | 2 +- ApiDemos/java/local.defaults.properties | 4 + ApiDemos/java/settings.gradle.kts | 2 +- ApiDemos/kotlin/README.md | 24 ++ ApiDemos/kotlin/app/build.gradle.kts | 12 +- .../kotlin/app/src/main/AndroidManifest.xml | 13 +- .../AdvancedMarkersDemoActivity.kt | 2 +- .../DataDrivenBoundariesActivity.kt | 225 +++++++++++ .../DataDrivenDatasetStylingActivity.kt | 360 +++++++++++++++++ .../example/kotlindemos/DemoDetailsList.kt | 10 + .../kotlindemos/MapColorSchemeActivity.kt | 2 +- .../main/res/layout/camera_clamping_demo.xml | 2 +- .../layout/data_driven_boundaries_demo.xml | 53 +++ .../res/layout/data_driven_styling_demo.xml | 84 ++++ .../app/src/main/res/layout/events_demo.xml | 2 +- .../main/res/layout/ground_overlay_demo.xml | 2 +- .../app/src/main/res/layout/indoor_demo.xml | 2 +- .../app/src/main/res/layout/layers_demo.xml | 2 +- .../app/src/main/res/layout/lite_demo.xml | 2 +- .../main/res/layout/map_color_scheme_demo.xml | 2 +- .../src/main/res/layout/map_in_pager_demo.xml | 2 +- .../app/src/main/res/layout/multimap_demo.xml | 2 +- .../src/main/res/layout/my_location_demo.xml | 2 +- .../app/src/main/res/layout/options_demo.xml | 2 +- .../src/main/res/layout/raw_mapview_demo.xml | 2 +- .../src/main/res/layout/save_state_demo.xml | 2 +- .../app/src/main/res/layout/snapshot_demo.xml | 2 +- ...plit_street_view_panorama_and_map_demo.xml | 2 +- .../street_view_panorama_basic_demo.xml | 2 +- .../street_view_panorama_events_demo.xml | 2 +- .../street_view_panorama_options_demo.xml | 2 +- .../src/main/res/layout/styled_map_demo.xml | 2 +- .../app/src/main/res/layout/text_fragment.xml | 2 +- .../main/res/layout/tile_coordinate_demo.xml | 2 +- .../src/main/res/layout/tile_overlay_demo.xml | 2 +- .../main/res/layout/visible_region_demo.xml | 2 +- .../kotlin/app/src/main/res/values/colors.xml | 2 + .../app/src/main/res/values/strings.xml | 17 +- .../kotlin/app/src/main/res/values/styles.xml | 5 +- ApiDemos/kotlin/build.gradle.kts | 2 +- ApiDemos/kotlin/gradle/libs.versions.toml | 46 ++- .../gradle/wrapper/gradle-wrapper.properties | 2 +- ApiDemos/kotlin/local.defaults.properties | 6 +- ApiDemos/kotlin/settings.gradle.kts | 2 +- ApiDemos/resources/README.md | 119 ++++++ ApiDemos/resources/boulder_polylines.geojson | 20 + ApiDemos/resources/kyoto_polygons.geojson | 232 +++++++++++ ApiDemos/resources/new_york_points.csv | 74 ++++ 128 files changed, 2192 insertions(+), 136 deletions(-) create mode 100644 ApiDemos/java/app/src/main/java/com/example/mapdemo/ApiDemoApplication.java create mode 100644 ApiDemos/java/app/src/main/java/com/example/mapdemo/DataDrivenBoundariesActivity.java create mode 100644 ApiDemos/java/app/src/main/java/com/example/mapdemo/DataDrivenDatasetStylingActivity.java create mode 100644 ApiDemos/java/app/src/main/res/layout/data_driven_boundaries_demo.xml create mode 100644 ApiDemos/java/app/src/main/res/layout/data_driven_styling_demo.xml create mode 100644 ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos/DataDrivenBoundariesActivity.kt create mode 100644 ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos/DataDrivenDatasetStylingActivity.kt create mode 100644 ApiDemos/kotlin/app/src/main/res/layout/data_driven_boundaries_demo.xml create mode 100644 ApiDemos/kotlin/app/src/main/res/layout/data_driven_styling_demo.xml create mode 100644 ApiDemos/resources/README.md create mode 100644 ApiDemos/resources/boulder_polylines.geojson create mode 100644 ApiDemos/resources/kyoto_polygons.geojson create mode 100644 ApiDemos/resources/new_york_points.csv diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99cfb485..2a721e95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,8 +45,12 @@ jobs: - name: Build and check run: | cd ApiDemos - for dir in ./*/ ; do ( cd "$dir" && ./gradlew buildDebugPreBundle ); done - + for dir in ./*/ ; do + if [[ "$dir" != "./resources/" ]]; then + ( cd "$dir" && ./gradlew buildDebugPreBundle ) + fi + done + build-WearOS: runs-on: ubuntu-latest timeout-minutes: 45 diff --git a/ApiDemos/java/app/build.gradle.kts b/ApiDemos/java/app/build.gradle.kts index 7a60ee03..3315fa4b 100644 --- a/ApiDemos/java/app/build.gradle.kts +++ b/ApiDemos/java/app/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ApiDemos/java/app/src/main/AndroidManifest.xml b/ApiDemos/java/app/src/main/AndroidManifest.xml index c7b33001..1f982433 100644 --- a/ApiDemos/java/app/src/main/AndroidManifest.xml +++ b/ApiDemos/java/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + + + + + + + + +