Skip to content

Comments

feat: rewrite android maps utils#1658

Open
kikoso wants to merge 51 commits intomainfrom
feat/rewrite-android-maps-utils
Open

feat: rewrite android maps utils#1658
kikoso wants to merge 51 commits intomainfrom
feat/rewrite-android-maps-utils

Conversation

@kikoso
Copy link
Collaborator

@kikoso kikoso commented Feb 24, 2026

Draft PR.

kikoso and others added 30 commits October 30, 2025 15:46
Previously, the  task did not correctly trigger the  check, allowing the demo app to attempt building without the necessary API key. This commit refines the logic to:
- Enforce  presence for all tasks that build the  module (e.g., , , , , ).
- Allow non-build tasks (e.g., , ) to proceed without the  file, printing a warning instead of throwing an error.

This ensures that tests can run independently while preventing incomplete demo app builds.
The secrets check in `demo/build.gradle.kts` has been refined to address issues with Android Studio Gradle syncs and to more accurately enforce the presence of `secrets.properties` for build-related tasks.

Previously, the script would fail during an Android Studio sync (when no specific tasks are requested) due to an overly broad interpretation of "build task." This commit introduces the following changes:

- **Graceful handling of IDE syncs:** If no tasks are explicitly requested (common during IDE sync), a warning is now issued instead of a hard failure. This allows the IDE to sync successfully while still informing the developer about the missing secrets.
- **Stricter enforcement for build tasks:** For command-line builds or tasks that are not explicitly exempt (e.g., `clean`, `test`, `lint`), the script will now correctly throw an error if `secrets.properties` is missing.

This ensures a better developer experience by preventing unnecessary build failures during IDE operations, while maintaining the necessary security check for actual application builds.
The previous logic prevented any  task from running without a  file. This change allows the  task to run if it's accompanied by a test-related task, such as . This enables running test reports without needing to provide API keys.
…tasks (e.g., `:demo:assembleDebug`) when validating secrets.
Improved and expanded assertions in `GeoJsonParserTest` for:
- `earthquakes_with_usa.json`
- `south_london_line_geojson.json`
- `south_london_square_geojson.json`
- `usa.json`
- `earthquakes.json`

Tests now include detailed verification of feature counts, properties, geometry types, and coordinate values to ensure robust GeoJSON parsing.
adds Truth Subjects for Points and LatLngAlt.kt
Establish the pattern to migrate off GeoData object.

Additionally, a minor typo in `testAmuBallonGxPrefix` has been corrected.
- Add `LatLonBoxSubject` to support cleaner, tolerance-based assertions for KML bounds using Google Truth.
- Update `amu_empty_hotspot.kml` to wrap contents in a `<Document>` tag, ensuring valid KML structure for parsing.
- Refactor `KmlParserTest` to use new assertions, remove dead code/comments, and fix a resource filename typo ("ballon" -> "balloon").
- Inline variable in `KmlParser.parseAsKml` for brevity.
Adds support for rotation in LatLonBox
Update the geojson tests to use the geojson specific model.
Refactor GeoJSON parsing and mapping for type-safe coordinates.

This commit refactors GeoJSON parsing to use a new Coordinates data class, simplifying GeoJsonObjects and GeoJsonParser. It also introduces a platform-agnostic renderer model and an initial MapViewRenderer implementation. Test updates are included to reflect these changes and ensure correctness, improving overall code robustness and maintainability.
This commit introduces the `KmlMapper` to transform KML data models into the platform-agnostic renderer model (`Scene` and `Feature` objects).

Key changes include:
- **`KmlMapper.kt`**: A new mapper that converts existing KML parser model objects into the generic renderer model, handling geometry transformations and nullability.
- **`KmlMapperTest.kt`**: Comprehensive unit tests to verify the correct functioning of the `KmlMapper`, ensuring accurate conversion of KML Points, LineStrings, Polygons, and MultiGeometries, as well as handling of nested structures and null-safe coordinate access.

This adds support for KML data within the new `onion` rendering architecture, leveraging existing KML parsing capabilities.
dkhawk and others added 21 commits November 23, 2025 05:39
This commit refactors the KmlPoint class to directly use a LatLngAlt object for its coordinates,
improving type safety and consistency with the new serialization approach.

Key changes include:
- `LatLngAltSerializer.kt`: Created a custom serializer for `LatLngAlt` to handle string parsing and serialization.
- `LatLngAlt.kt`: Updated to use the new `@Serializable(with = LatLngAltSerializer::class)` annotation and removed the now redundant `fromString` method.
- `KmlModel.kt`, `KmlParser.kt`, `KmlMapper.kt`: Updated to reflect the change in `KmlPoint`s coordinates from `String` to `LatLngAlt`, resolving compilation errors and ensuring correct data flow.
- Unit tests (`KmlParserTest.kt`, `PointSubject.kt`, `KmlMapperTest.kt`): Modified to align with the new `LatLngAlt` object usage in `KmlPoint`, verifying the integrity of the parsing and mapping logic.
This commit refactors the KML parsing model to use custom serializers for Boolean and Color values,
improving type safety and consistency. This change also includes fixing parsing and mapping logic.

Key changes include:
- `BooleanSerializer.kt`: Created a custom serializer for `Boolean` to handle KMLs "1"/"0" and "true"/"false" string formats.
- `ColorSerializer.kt`: Created a custom serializer for `Color` to parse KMLs `aabbggrr` hex string format into an ARGB `Int`.
- `KmlModel.kt`: Updated `GroundOverlay`, `Folder`, `Polygon`, and `PolyStyle` classes to use the new `BooleanSerializer` for `visibility`, `extrude`, `fill`, and `outline` properties, removing the transient properties and string-based fields. The `asBoolean()` helper function was removed.
- `KmlModel.kt`: Updated `GroundOverlay`, `LabelStyle`, `LineStyle`, and `PolyStyle` to use the new `ColorSerializer` for their `color` properties.
- Unit tests (`KmlParserTest.kt`): Modified to align with the new `Boolean` and `Int` usage, correcting assertions for color values.
This commit integrates the new 'onion' rendering module into the demo application and resolves multiple build and runtime issues to create a functional demonstration.

Key changes include:
- Adds a new `RendererDemoActivity` to showcase the KML rendering capabilities.
- Wires up the new activity in the main navigation and AndroidManifest.
- Adds `top_peaks.kml` and `mountain_ranges.kml` as demo assets.
- Resolves a duplicate `RendererLogger` class by removing it from the `onion` module.
- Fixes a JVM incompatibility issue by enforcing a Java 17 toolchain across all projects.
- Updates the `onion` module's namespace and refactors several components to support the demo, including `KmlMapper` and `MapViewRenderer`.
This commit addresses several review comments from PR #9, focusing on code cleanup and build process improvements:

- Ignored `.vscode/settings.json` locally to prevent tracking IDE-specific configurations.
- Removed duplicate `PublishingConventionPlugin.kt` from `build-logic/convention/bin` and added `build-logic/convention/bin` to `.gitignore`, cleaning up build artifacts.
- Removed commented-out MIME type suggestions from `RendererDemoActivity.kt` to eliminate dead code.
- Removed the `lint-checks/bin` directory and added it to `.gitignore`, further cleaning up build artifacts.
- Removed the deprecated `installation` block from `onion/build.gradle.kts` as it is no longer useful and will be removed in future Gradle versions.
- Kept the `plugins.withId("java")` block in root `build.gradle.kts` as it correctly configures the Java toolchain for multi-module projects.
- Enable Advanced Markers in RendererDemoActivity
- Fix GroundOverlay NPE in MapViewRenderer
- Clean up RendererDemoActivity code
- Add test coverage for onion module
- Refactor onion module to use DataLayer/DataScene/DataRenderer
- Add KML/GeoJSON/GPX parsing and rendering support
- Add toast for successful layer loading in RendererDemoActivity
- Use imports instead of FQDNs in RendererDemoActivity
- Reuse icon loading jobs in MapViewRenderer to avoid redundant requests
feat: refactor onion module and update demo app
* feat: genAi test

* feat: added an NLP helper

* chore: removed unused imports

* feat: modularisation

* feat: PR comments
* feat(demo): improve renderer demo UI

- Add toggleable chips for layer visibility
- Add bottom sheet toggle button
- Remove unnecessary Toast messages

* feat(onion): add unified DataLayerLoader and supported extensions

- Create DataLayerLoader for unified asset and stream loading
- Add SUPPORTED_EXTENSIONS to all parsers
- Implement content sniffing and extension matching logic

* fix(onion): improve icon loading job management in MapViewRenderer

- Track icon loading jobs per Feature instead of per URL to prevent premature cancellation
- Fix potential race conditions in icon caching and assignment

* feat(demo): improve renderer demo UI

- Add toggleable chips for layer visibility
- Add bottom sheet toggle button
- Remove unnecessary Toast messages

* feat(onion): add unified DataLayerLoader and supported extensions

- Create DataLayerLoader for unified asset and stream loading
- Add SUPPORTED_EXTENSIONS to all parsers
- Implement content sniffing and extension matching logic

* fix(onion): improve icon loading job management in MapViewRenderer

- Track icon loading jobs per Feature instead of per URL to prevent premature cancellation
- Fix potential race conditions in icon caching and assignment

* Refactor IconProvider to use suspend functions and fix build errors

* Optimize UrlIconProvider with thundering herd fix and add unit tests

* chore: remove debug log message

* feat: using Gemini to perform UI tests (#8)

* feat: genAi test

* feat: added an NLP helper

* chore: removed unused imports

* feat: modularisation

* feat: PR comments

* fix(onion): improve icon loading job management in MapViewRenderer

- Track icon loading jobs per Feature instead of per URL to prevent premature cancellation
- Fix potential race conditions in icon caching and assignment

# Conflicts:
#	onion/src/main/java/com/google/maps/android/data/renderer/mapview/MapViewRenderer.kt

* chore: manually merging back in the DataLayerLoader.

* fix: Fixed icon loading

* chore: Update dependencies

Also sort the toml file

---------

Co-authored-by: Enrique López-Mañas <eenriquelopez@gmail.com>
* feat(ui): port ui module to Kotlin and refactor visual tests

Ported IconGenerator, AnimationUtil, BubbleDrawable, RotationLayout, SquareTextView, and BubbleIconFactory to Kotlin. Refactored visual tests to use a shared BaseVisualTest for better maintainability and robustness.

* fix(ui): update copyright to 2026 and fix lint issues

* feat(ui): address review feedback and include local visual test improvements

* fix: make LatLngInterpolator
* feat: migrated algorithm and clusters

* feat: migrated renderer

* chore: refactor algorithms

* feat: more algorithms

* feat: more algorithms

* feat: more algorithms

* feat: more arenderers

* feat: more arenderers

* feat: migrated ClusterManager

* feat: removed build error file
@kikoso kikoso requested a review from a team as a code owner February 24, 2026 17:39
@kikoso kikoso changed the title Feat/rewrite android maps utils feat: rewrite android maps utils Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants