Skip to content

Conversation

dkhawk
Copy link
Collaborator

@dkhawk dkhawk commented Aug 25, 2025

Updates for v0.0.3 of the maps3d library.

Includes demonstration of click handling for places, markers, polylines and polygons

dkhawk added 7 commits August 25, 2025 10:24
This commit introduces Espresso UI tests for `HelloMapActivity` in both the Java and Kotlin sample apps to verify that the map view is displayed.

Additionally, this commit includes several build and dependency updates:
- Upgrades Gradle, the Android Gradle Plugin, Kotlin, and other AndroidX libraries.
- Centralizes `minSdk` and `targetSdk` in the version catalog (`libs.versions.toml`).
- Moves the Maps 3D SDK dependency to the `common` module and exposes it to the app modules using the `api` configuration.
This commit introduces an instrumented test for `CameraControlsActivity`.

The test verifies two main functionalities:
- The `Map3DView` is displayed correctly.
- The "Fly to" button animates the camera to the expected location.

The `androidx.test.uiautomator` dependency was added to support the test implementation.
This commit introduces a new instrumentation test, `testFlyAround`, to `CameraControlsActivityTest`.

The test verifies the functionality of the "Fly Around" button by clicking it and then using `OnMapSteadyListener` to assert that the animation completes and the map returns to a steady state.
This commit updates the project to use version 0.0.3 of the Maps3D SDK, which is now included as a local AAR file. It also updates various dependencies, including the Android Gradle Plugin, Kotlin, Compose BOM, and the Gradle wrapper.

Key API changes from the SDK update have been applied:
*   `PolygonOptions.outerCoordinates` is now `path`.
*   `PolygonOptions.innerCoordinates` is now `innerPaths`.
*   `PolylineOptions.coordinates` is now `path`.

Additionally, the build configuration is streamlined by centralizing `compileSdk`, `minSdk`, and `targetSdk` versions in the `libs.versions.toml` files.
This commit adds the Google Truth assertion library as a testing dependency for both the Java and Kotlin sample apps.

Existing instrumentation tests have been refactored to use Truth's fluent `assertThat` API instead of JUnit assertions, improving the readability and expressiveness of the test code.
This commit introduces click handling for various map elements and adds a new sample to demonstrate place clicks.

- **Map Interactions Sample:** A new `MapInteractionsActivity` has been added to show how to use `setMap3DClickListener` to handle clicks on the map and on places.
- **Marker Clicks:** The `MarkersActivity` now sets a `clickListener` on each marker, displaying a `Toast` with the marker's label when clicked.
- **Polyline Clicks:** The `PolylinesActivity` now sets a `clickListener` on the trail polyline.
- **Polygon Clicks:** The `PolygonsActivity` now sets `clickListener`s on the museum and zoo polygons.
@dkhawk dkhawk requested a review from kikoso August 25, 2025 23:17
This commit introduces several improvements to the sample applications:

- The build configuration is updated across all modules to depend on a local `play-services-maps3d` AAR file instead of a remote dependency.
- The Kotlin `MainActivity` is refactored to use a `Sample` data class for the list of demos, improving type safety and code readability.
- The XML themes for the Java and Kotlin ApiDemos apps are updated to consistently use `Theme.Material3.DayNight.NoActionBar`.
@dkhawk dkhawk marked this pull request as draft August 26, 2025 00:35
dkhawk added 5 commits August 25, 2025 18:36
This commit enhances the `HelloMapActivity` and `MarkersActivity` samples with improved documentation and modern Android development patterns.

Key changes include:
- Expanded KDoc comments in `HelloMapActivity` and `MarkersActivity` to provide more detailed explanations of the code and concepts.
- Refactored `MarkersActivity` to use `lifecycleScope` for managing coroutines and to extract marker creation and click listener setup into separate functions.
- Updated `SampleBaseActivity` to extend `AppCompatActivity` for better support and consistency.
- Moved the `TAG` definition in `HelloMapActivity` to a `companion object` to follow common Kotlin idioms.
This commit refactors `ModelsActivity` for better code organization, readability, and lifecycle safety.

Key changes include:
- Replaced `CoroutineScope(Dispatchers.Main)` with `lifecycleScope` to tie coroutines to the activity's lifecycle, preventing potential leaks.
- Extracted logic into smaller, well-documented helper functions like `setupUI`, `addPlaneModel`, and `runAnimationSequence`.
- Used `kotlin.time.Duration` for more readable and type-safe time values in animations and flows.
- Added extensive KDoc comments to the class and methods to improve documentation.
This commit refactors the `PolygonsActivity` to improve code organization, clarity, and lifecycle management.

Key changes include:
- Extracting the logic for adding polygons and setting up click listeners into dedicated functions (`addMuseumPolygons`, `addZooPolygon`, `setupPolygonClickListener`).
- Switching from a manual `CoroutineScope` to `lifecycleScope` for safer coroutine handling that is tied to the activity's lifecycle.
- Adding extensive KDoc comments to the class, methods, and properties to better document the sample's functionality.
- Using `by lazy` to defer the initialization of polygon coordinate data until first use.
This commit refactors the `PolylinesActivity` to improve code quality, readability, and documentation.

Key changes include:
- Expanded the KDoc for the activity to better explain the sample's purpose and implementation details.
- Extracted logic for adding polylines and setting up click listeners into separate, focused functions.
- Switched from a manually created `CoroutineScope` to the lifecycle-aware `lifecycleScope`.
- Used `by lazy` for deferred initialization of polyline options and trail data, improving performance.
- Simplified the parsing of trail location data using more idiomatic Kotlin.
Loading the files locally left as comments for reference
@dkhawk dkhawk marked this pull request as ready for review August 26, 2025 01:07
dkhawk added 2 commits August 25, 2025 19:10
Adds a click listener to the airplane model in the `ModelsActivity` sample. A toast message is shown when the model is clicked to demonstrate the feature.
@knishant362
Copy link

Hi @kikoso, When can we expect this release 0.0.3 to rollout for public

@tejbhansahu
Copy link

Hi @kikoso & @dkhawk, eagerly waiting for this release.
Thanks.

@knishant362
Copy link

Hi @dkhawk @kikoso , Any update on this?

@anmolgupta22
Copy link

Hi @kikoso & @dkhawk, can you have any update for release.

@Vinay310
Copy link

Vinay310 commented Sep 8, 2025

Hi @dkhawk & @kikoso, Do we have any update for the release ?

@kikoso
Copy link
Collaborator

kikoso commented Sep 8, 2025

Hello folks. There is no specific release date to share yet for the new version of Maps 3D. You can subscribe to this thread, and check the official Google Maps Platform channel.

This commit updates the Gradle version and refreshes various project dependencies across the sample applications.

Key changes:
- **Gradle Upgrade:** Upgraded the Gradle wrapper from version 8.11.1 to 9.1.0. This includes updating the `gradlew` and `gradlew.bat` scripts and the wrapper JAR to the versions generated by Gradle 9.1.
- **Dependency Updates:** Updated several key libraries to their latest versions, including:
    - Android Gradle Plugin to 8.13.0
    - Kotlin to 2.2.20
    - Compose BOM to 2025.09.00
    - Hilt to 2.57.1
    - Various AndroidX, KSP, and testing libraries.
- **Build Script Refactor:** In the `ApiDemos` project, the `play-services-maps3d` dependency is now referenced through the version catalog for consistency.
This commit introduces several cleanups and refactorings across the API Demos samples, primarily focusing on the Gradle build scripts and the Java sample application.

- **Gradle Build Scripts:**
    - The `sarifOutput` path for lint reports is now consistently configured using the modern `layout.buildDirectory` API across all modules.
    - In the `java-app`, SDK versions (`compileSdk`, `minSdk`, `targetSdk`) are now sourced from the version catalog (`libs.versions`) instead of being hardcoded.

- **Java Sample App (`java-app`):**
    - Removed Kotlin and Jetpack Compose plugins and dependencies, making it a pure Java-based sample.
    - Updated Javadoc comments to follow standard Java conventions, removing Kotlin-style syntax.

- **Kotlin Code:**
    - Corrected a `@StringRes` annotation target in `Units.kt` for better precision.
    - Removed an unused import in `MainActivity.kt`.
    - Enabled `buildConfig` in the `kotlin-app` module.
This commit updates the Java API Demos app to support edge-to-edge display, allowing the app's UI to draw behind the system status and navigation bars for a more immersive experience.

Key changes:

-   **Theme Updates (`themes.xml`):**
    -   The status and navigation bars are set to transparent.
    -   The theme is configured to allow drawing behind system bars (`windowDrawsSystemBarBackgrounds`) and to render in the display cutout area.

-   **Activity Changes (`MainActivity` & `SampleBaseActivity`):**
    -   `WindowCompat.setDecorFitsSystemWindows(false)` is called to enable edge-to-edge mode.
    -   An `OnApplyWindowInsetsListener` is used to get the system bar insets and apply them as padding to the root view. This ensures that interactive UI elements are not obscured by the system bars.

-   **Refinement:** The inset handling logic in `SampleBaseActivity` has been simplified to use `WindowInsetsCompat.Type.systemBars()` for a cleaner implementation.
This commit updates the project's dependencies to use version 0.0.3 of the Maps 3D SDK.

Key changes:
- The `play-services-maps3d` dependency is updated from version 0.0.2 to 0.0.3 in `libs.versions.toml`.
- The SDK is now included as a local AAR file (`play-services-maps3d-0.0.3.aar`) in the `common`, `java-app`, and `kotlin-app` modules.
- A new dependency on `play-services-base` has been added to all modules, as required by the updated SDK.
- The version catalog (`libs.versions.toml`) has been updated to include `play-services-base`, `truth`, and `uiautomator`.
- Implemented click listeners for markers, polygons, polylines, and models to demonstrate new interactive features.
- Updated Polygon and Polyline options to use the new `path` and `innerPaths` properties, aligning with the latest API.
- Refactored `MarkersActivity` to use a helper method for marker creation, improving code clarity and reducing repetition.
- Added a migration guide to assist users in updating to the new SDK version.
- Abstracted Toast notifications into a `showToast` helper method in `SampleBaseActivity` to reduce boilerplate in individual activities.
- Replaced hardcoded strings in click listeners with string resources for better maintainability and localization.
This commit refactors the Java API Demos sample app by moving shared resources to the `common` module and simplifying code.

Key changes:
-   **Code Simplification in `CameraControlsActivity`:**
    -   The `updateCameraPosition` method now uses a single formatted string resource (`camera_state_format`) instead of manual `StringBuilder` concatenation, making the code cleaner and more localizable.
    -   UI updates are now posted to the main thread using `runOnUiThread` and `view.postDelayed` instead of `new Handler(Looper.getMainLooper())`.

-   **Lifecycle Method Cleanup in `HelloMapActivity`:**
    -   Removed redundant null checks for `map3DView` in lifecycle callback methods (`onResume`, `onPause`, `onDestroy`, etc.), as the view is initialized in `onCreate`.
This commit updates the project's dependencies and build configuration.

Key changes:
- **Gradle Build Script:** The `sarifOutput` path in `build.gradle.kts` was updated to use the modern `layout.buildDirectory` API.
- **Lint Fix:** Added a `@param:StringRes` annotation target in `MainActivity.kt` to resolve a lint warning.
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.

6 participants