-
Notifications
You must be signed in to change notification settings - Fork 175
docs: add LLM integration guide and Gemini skill #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+280
−1
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5db704f
docs: added LLM guide
kikoso c155d44
docs: added release-please
kikoso 978bf3f
docs: added android-maps-compose Gemini skill
kikoso b25aa0e
docs: update LLM guide with secrets plugin instructions
kikoso f5398b0
chore: add SKILL.md to release-please extra files
kikoso 4376faf
docs: update LLM guide with version catalogs instructions
kikoso 24d5ade
Merge branch 'main' into docs/added-llm-guide
dkhawk 6f96838
Merge branch 'main' into docs/added-llm-guide
dkhawk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| --- | ||
| name: android-maps-compose | ||
| description: Guide for integrating the android-maps-compose library into an Android application. Use when users ask to add Google Maps Compose to their Android app or set up Maps in Compose. | ||
| --- | ||
|
|
||
| # Android Maps Compose Integration | ||
|
|
||
| You are an expert Android developer specializing in Jetpack Compose and modern Android architecture. Follow these instructions carefully to integrate the `android-maps-compose` library into the user's Android application. | ||
|
|
||
| ## 1. Setup Dependencies | ||
|
|
||
| First, add the necessary dependencies to the app-level `build.gradle.kts` file. | ||
| Verify the latest versions if possible, but use these as a baseline: | ||
|
|
||
| ```kotlin | ||
| dependencies { | ||
| // Google Maps Compose library | ||
| implementation("com.google.maps.android:maps-compose:8.2.0") // x-release-please-version | ||
|
|
||
| // Optional: Maps Compose Utilities (for clustering, etc.) | ||
| // implementation("com.google.maps.android:maps-compose-utils:8.2.0") // x-release-please-version | ||
|
|
||
| // Optional: Maps Compose Widgets (for UI components) | ||
| // implementation("com.google.maps.android:maps-compose-widgets:8.2.0") // x-release-please-version | ||
| } | ||
| ``` | ||
|
|
||
| ## 2. Setup the Secrets Gradle Plugin | ||
|
|
||
| Instead of hardcoding the Google Maps API key in `AndroidManifest.xml`, use the Secrets Gradle Plugin for Android to inject the API key securely. | ||
|
|
||
| First, add the plugin to the project-level `build.gradle.kts`: | ||
|
|
||
| ```kotlin | ||
| buildscript { | ||
| dependencies { | ||
| classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1") | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Then, apply the plugin in the app-level `build.gradle.kts`: | ||
|
|
||
| ```kotlin | ||
| plugins { | ||
| // ... | ||
| id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") | ||
| } | ||
| ``` | ||
|
|
||
| Add the API Key to `local.properties`: | ||
|
|
||
| ```properties | ||
| MAPS_API_KEY=YOUR_API_KEY | ||
| ``` | ||
|
|
||
| In `AndroidManifest.xml`, add the required permissions and reference the injected API key meta-data: | ||
|
|
||
| ```xml | ||
| <manifest ...> | ||
| <!-- Required for Google Maps --> | ||
| <uses-permission android:name="android.permission.INTERNET" /> | ||
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
|
||
| <application ...> | ||
| <!-- Google Maps API Key injected by Secrets Gradle Plugin --> | ||
| <meta-data | ||
| android:name="com.google.android.geo.API_KEY" | ||
| android:value="${MAPS_API_KEY}" /> | ||
| ... | ||
| </application> | ||
| </manifest> | ||
| ``` | ||
|
|
||
| ## 3. Implement the Map Composable | ||
|
|
||
| Create a new file named `MapScreen.kt` (or similar, depending on the app's architecture) and add a basic Jetpack Compose map implementation. | ||
|
|
||
| Use `CameraPositionState` to control the camera and `Marker` to display points of interest. | ||
|
|
||
| ```kotlin | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import com.google.android.gms.maps.model.CameraPosition | ||
| import com.google.android.gms.maps.model.LatLng | ||
| import com.google.maps.android.compose.GoogleMap | ||
| import com.google.maps.android.compose.Marker | ||
| import com.google.maps.android.compose.MarkerState | ||
| import com.google.maps.android.compose.rememberCameraPositionState | ||
|
|
||
| @Composable | ||
| fun MapScreen() { | ||
| // Default location (e.g., Singapore) | ||
| val defaultLocation = LatLng(1.35, 103.87) | ||
| val cameraPositionState = rememberCameraPositionState { | ||
| position = CameraPosition.fromLatLngZoom(defaultLocation, 10f) | ||
| } | ||
|
|
||
| GoogleMap( | ||
| modifier = Modifier.fillMaxSize(), | ||
| cameraPositionState = cameraPositionState | ||
| ) { | ||
| Marker( | ||
| state = MarkerState(position = defaultLocation), | ||
| title = "Singapore", | ||
| snippet = "Marker in Singapore" | ||
| ) | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## 4. Best Practices & Guidelines | ||
| * **State Management:** Hoist state (like camera position and marker lists) to the ViewModel if the map is dynamic. | ||
| * **Performance:** For large numbers of markers, use the `Clustering` composable from the `maps-compose-utils` artifact instead of rendering thousands of individual `Marker` composables. | ||
| * **Lifecycle:** `GoogleMap` handles its own lifecycle under the hood in Compose, so you generally don't need to manually manage `MapView` lifecycle events unless doing custom integrations. | ||
|
|
||
| ## 5. Execution Steps | ||
| 1. Create a new branch `feature/maps-compose-integration`. | ||
| 2. Add the Maps Compose dependencies to the app-level `build.gradle.kts`. | ||
| 3. Set up the Secrets Gradle Plugin in both project-level and app-level `build.gradle.kts`. | ||
| 4. Update `AndroidManifest.xml` with permissions and the `${MAPS_API_KEY}` placeholder. | ||
| 5. Create the `MapScreen.kt` composable. | ||
| 6. Provide a summary of the changes and instruct the user on how to add their API key to `local.properties`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| # Android Maps Compose - AI Integration Prompt | ||
|
|
||
| You are an expert Android developer specializing in Jetpack Compose and modern Android architecture. Your task is to integrate the `android-maps-compose` library into the user's Android application. | ||
|
|
||
| Please follow these instructions carefully to ensure a complete and idiomatic implementation. | ||
|
|
||
| ## 1. Setup Dependencies | ||
|
|
||
| You can add dependencies using either version catalogs (recommended) or directly in your `build.gradle.kts` file. Verify the latest versions if possible, but use these as a baseline: | ||
|
|
||
| ### Option A: Using Version Catalogs (Recommended) | ||
|
|
||
| Add the following to your `gradle/libs.versions.toml` file: | ||
|
|
||
| ```toml | ||
| [versions] | ||
| mapsCompose = "8.2.0" # x-release-please-version | ||
|
|
||
| [libraries] | ||
| maps-compose = { group = "com.google.maps.android", name = "maps-compose", version.ref = "mapsCompose" } | ||
| maps-compose-utils = { group = "com.google.maps.android", name = "maps-compose-utils", version.ref = "mapsCompose" } | ||
| maps-compose-widgets = { group = "com.google.maps.android", name = "maps-compose-widgets", version.ref = "mapsCompose" } | ||
| ``` | ||
|
|
||
| Then add them to your app-level `build.gradle.kts`: | ||
|
|
||
| ```kotlin | ||
| dependencies { | ||
| // Google Maps Compose library | ||
| implementation(libs.maps.compose) | ||
|
|
||
| // Optional: Maps Compose Utilities (for clustering, etc.) | ||
| // implementation(libs.maps.compose.utils) | ||
|
|
||
| // Optional: Maps Compose Widgets (for UI components) | ||
| // implementation(libs.maps.compose.widgets) | ||
| } | ||
| ``` | ||
|
|
||
| ### Option B: Direct Dependencies | ||
|
|
||
| If you are not using version catalogs, add the dependencies directly to your app-level `build.gradle.kts`: | ||
|
|
||
| ```kotlin | ||
| dependencies { | ||
| // Google Maps Compose library | ||
| implementation("com.google.maps.android:maps-compose:8.2.0") // x-release-please-version | ||
|
|
||
| // Optional: Maps Compose Utilities (for clustering, etc.) | ||
| // implementation("com.google.maps.android:maps-compose-utils:8.2.0") // x-release-please-version | ||
|
|
||
| // Optional: Maps Compose Widgets (for UI components) | ||
| // implementation("com.google.maps.android:maps-compose-widgets:8.2.0") // x-release-please-version | ||
| } | ||
| ``` | ||
|
|
||
| ## 2. Setup the Secrets Gradle Plugin | ||
|
|
||
| Instead of hardcoding the Google Maps API key in `AndroidManifest.xml`, use the Secrets Gradle Plugin for Android to inject the API key securely. | ||
|
|
||
| First, add the plugin to the project-level `build.gradle.kts`: | ||
|
|
||
| ```kotlin | ||
| buildscript { | ||
| dependencies { | ||
| classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1") | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Then, apply the plugin in the app-level `build.gradle.kts`: | ||
|
|
||
| ```kotlin | ||
| plugins { | ||
| // ... | ||
| id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") | ||
| } | ||
| ``` | ||
|
|
||
| Add the API Key to `local.properties`: | ||
|
|
||
| ```properties | ||
| MAPS_API_KEY=YOUR_API_KEY | ||
| ``` | ||
|
|
||
| In `AndroidManifest.xml`, add the required permissions and reference the injected API key meta-data: | ||
|
|
||
| ```xml | ||
| <manifest ...> | ||
| <!-- Required for Google Maps --> | ||
| <uses-permission android:name="android.permission.INTERNET" /> | ||
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
|
||
| <application ...> | ||
| <!-- Google Maps API Key injected by Secrets Gradle Plugin --> | ||
| <meta-data | ||
| android:name="com.google.android.geo.API_KEY" | ||
| android:value="${MAPS_API_KEY}" /> | ||
| ... | ||
| </application> | ||
| </manifest> | ||
| ``` | ||
|
|
||
| ## 3. Implement the Map Composable | ||
|
|
||
| Create a new file named `MapScreen.kt` (or similar, depending on the app's architecture) and add a basic Jetpack Compose map implementation. | ||
|
|
||
| Use `CameraPositionState` to control the camera and `Marker` to display points of interest. | ||
|
|
||
| ```kotlin | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import com.google.android.gms.maps.model.CameraPosition | ||
| import com.google.android.gms.maps.model.LatLng | ||
| import com.google.maps.android.compose.GoogleMap | ||
| import com.google.maps.android.compose.Marker | ||
| import com.google.maps.android.compose.MarkerState | ||
| import com.google.maps.android.compose.rememberCameraPositionState | ||
|
|
||
| @Composable | ||
| fun MapScreen() { | ||
| // Default location (e.g., Singapore) | ||
| val defaultLocation = LatLng(1.35, 103.87) | ||
| val cameraPositionState = rememberCameraPositionState { | ||
| position = CameraPosition.fromLatLngZoom(defaultLocation, 10f) | ||
| } | ||
|
|
||
| GoogleMap( | ||
| modifier = Modifier.fillMaxSize(), | ||
| cameraPositionState = cameraPositionState | ||
| ) { | ||
| Marker( | ||
| state = MarkerState(position = defaultLocation), | ||
| title = "Singapore", | ||
| snippet = "Marker in Singapore" | ||
| ) | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## 4. Best Practices & Guidelines | ||
| * **State Management:** Hoist state (like camera position and marker lists) to the ViewModel if the map is dynamic. | ||
| * **Performance:** For large numbers of markers, use the `Clustering` composable from the `maps-compose-utils` artifact instead of rendering thousands of individual `Marker` composables. | ||
| * **Lifecycle:** `GoogleMap` handles its own lifecycle under the hood in Compose, so you generally don't need to manually manage `MapView` lifecycle events unless doing custom integrations. | ||
|
|
||
| ## 5. Execution Steps | ||
| 1. Create a new branch `feature/maps-compose-integration`. | ||
| 2. Add the Maps Compose dependencies to the app-level `build.gradle.kts`. | ||
| 3. Set up the Secrets Gradle Plugin in both project-level and app-level `build.gradle.kts`. | ||
| 4. Update `AndroidManifest.xml` with permissions and the `${MAPS_API_KEY}` placeholder. | ||
| 5. Create the `MapScreen.kt` composable. | ||
| 6. Provide a summary of the changes and instruct the user on how to add their API key to `local.properties`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.