From 3630efc043472979ba6168027e5be8a0a4c3f824 Mon Sep 17 00:00:00 2001 From: Dale Hawkins <107309+dkhawk@users.noreply.github.com> Date: Mon, 14 Sep 2026 18:12:42 -0600 Subject: [PATCH] feat: introduce snippets common library module and documentation tools - Create :snippets:common library module with shared layouts, vector drawables, and raw assets - Add snippets/scripts/api_manifest.json mapping 2D Maps SDK public API endpoints - Add snippets/scripts/catalog_api.py for automated bytecode analysis and CATALOG.md/COVERAGE.md generation - Include :snippets:common in root settings.gradle.kts --- settings.gradle.kts | 2 + snippets/common/build.gradle.kts | 47 ++ snippets/common/src/main/AndroidManifest.xml | 20 + .../src/main/res/drawable/arrow_back_24px.xml | 25 + .../main/res/drawable/arrow_forward_24px.xml | 25 + .../main/res/drawable/photo_camera_24px.xml | 25 + .../main/res/drawable/restart_alt_24px.xml | 25 + .../src/main/res/layout/activity_main.xml | 35 ++ .../src/main/res/layout/activity_map.xml | 108 ++++ .../res/layout/list_item_group_header.xml | 25 + .../src/main/res/layout/list_item_snippet.xml | 44 ++ .../common/src/main/res/raw/geojson_file.json | 518 ++++++++++++++++++ snippets/common/src/main/res/raw/kml_file.kml | 194 +++++++ .../src/main/res/raw/police_stations.json | 347 ++++++++++++ snippets/scripts/api_manifest.json | 213 +++++++ snippets/scripts/catalog_api.py | 375 +++++++++++++ 16 files changed, 2028 insertions(+) create mode 100644 snippets/common/build.gradle.kts create mode 100644 snippets/common/src/main/AndroidManifest.xml create mode 100644 snippets/common/src/main/res/drawable/arrow_back_24px.xml create mode 100644 snippets/common/src/main/res/drawable/arrow_forward_24px.xml create mode 100644 snippets/common/src/main/res/drawable/photo_camera_24px.xml create mode 100644 snippets/common/src/main/res/drawable/restart_alt_24px.xml create mode 100644 snippets/common/src/main/res/layout/activity_main.xml create mode 100644 snippets/common/src/main/res/layout/activity_map.xml create mode 100644 snippets/common/src/main/res/layout/list_item_group_header.xml create mode 100644 snippets/common/src/main/res/layout/list_item_snippet.xml create mode 100644 snippets/common/src/main/res/raw/geojson_file.json create mode 100644 snippets/common/src/main/res/raw/kml_file.kml create mode 100644 snippets/common/src/main/res/raw/police_stations.json create mode 100644 snippets/scripts/api_manifest.json create mode 100644 snippets/scripts/catalog_api.py diff --git a/settings.gradle.kts b/settings.gradle.kts index 1eef03a80..998de4948 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -53,6 +53,8 @@ include(":WearOS:Wearable") project(":WearOS:Wearable").projectDir = file("WearOS/Wearable") // Snippets +include(":snippets:common") +project(":snippets:common").projectDir = file("snippets/common") include(":snippets:app") project(":snippets:app").projectDir = file("snippets/app") include(":snippets:app-ktx") diff --git a/snippets/common/build.gradle.kts b/snippets/common/build.gradle.kts new file mode 100644 index 000000000..559075eaf --- /dev/null +++ b/snippets/common/build.gradle.kts @@ -0,0 +1,47 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + alias(libs.plugins.android.library) +} + +android { + namespace = "com.example.snippets.common" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = libs.versions.minSdk.get().toInt() + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlin { + compilerOptions { + jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) + } + } +} + +dependencies { + implementation(libs.core.ktx) + implementation(libs.appcompat) + implementation(libs.material) + api(libs.play.services.maps) +} diff --git a/snippets/common/src/main/AndroidManifest.xml b/snippets/common/src/main/AndroidManifest.xml new file mode 100644 index 000000000..ce69061c1 --- /dev/null +++ b/snippets/common/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/snippets/common/src/main/res/drawable/arrow_back_24px.xml b/snippets/common/src/main/res/drawable/arrow_back_24px.xml new file mode 100644 index 000000000..dc5b4ec6f --- /dev/null +++ b/snippets/common/src/main/res/drawable/arrow_back_24px.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/snippets/common/src/main/res/drawable/arrow_forward_24px.xml b/snippets/common/src/main/res/drawable/arrow_forward_24px.xml new file mode 100644 index 000000000..1045694f5 --- /dev/null +++ b/snippets/common/src/main/res/drawable/arrow_forward_24px.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/snippets/common/src/main/res/drawable/photo_camera_24px.xml b/snippets/common/src/main/res/drawable/photo_camera_24px.xml new file mode 100644 index 000000000..456fea62b --- /dev/null +++ b/snippets/common/src/main/res/drawable/photo_camera_24px.xml @@ -0,0 +1,25 @@ + + + + diff --git a/snippets/common/src/main/res/drawable/restart_alt_24px.xml b/snippets/common/src/main/res/drawable/restart_alt_24px.xml new file mode 100644 index 000000000..32da08a3c --- /dev/null +++ b/snippets/common/src/main/res/drawable/restart_alt_24px.xml @@ -0,0 +1,25 @@ + + + + diff --git a/snippets/common/src/main/res/layout/activity_main.xml b/snippets/common/src/main/res/layout/activity_main.xml new file mode 100644 index 000000000..03cfc581d --- /dev/null +++ b/snippets/common/src/main/res/layout/activity_main.xml @@ -0,0 +1,35 @@ + + + + + + + + diff --git a/snippets/common/src/main/res/layout/activity_map.xml b/snippets/common/src/main/res/layout/activity_map.xml new file mode 100644 index 000000000..def3ed7e4 --- /dev/null +++ b/snippets/common/src/main/res/layout/activity_map.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + +