You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(demo): Add StreetViewJavaHelper and demo and enable edge-to-edge (#1595)
* feat(demo): Add Java demo for Street View utility
This commit adds a new demo activity written in Java to demonstrate the usage of the Street View utility. To facilitate this, a Kotlin helper has been introduced to bridge the gap between suspend functions and Java's callback-based asynchronous model.
The key changes are:
- **`StreetViewDemoActivityJava`**: A new demo activity that shows how to check for Street View availability from Java.
- **`StreetViewHelper`**: A Kotlin object that wraps the `suspend` function `StreetViewUtils.fetchStreetViewData` and exposes it to Java consumers via a callback interface.
- **`ApiKeyValidator`**: A new utility class to check for a valid Maps API key within the demo application.
- **Unit Tests**: Added tests for `StreetViewHelper` using Robolectric, MockK, and coroutine testing libraries to verify its behavior.
- **Dependencies**: Added `mockk`, `kotlinx-coroutines-test`, and `robolectric` to the demo module's test dependencies.
* feat(demo): Enable edge-to-edge for StreetView demo activities
This commit refactors the `StreetViewDemoActivity` in both its Kotlin and Java versions to support edge-to-edge display.
The key changes include:
- Changing the base class from `Activity` to `AppCompatActivity`.
- Using `WindowCompat.setDecorFitsSystemWindows` to allow the app to draw behind the system bars.
- Adding an `OnApplyWindowInsetsListener` to the root view to apply padding for the system bars, preventing content from being obscured.
- Updating the `street_view_demo.xml` layout with an ID for the root view to facilitate the insets listener.
- Updating the copyright year.
* refactor(library): Move StreetViewJavaHelper to library module
This commit moves the `StreetViewHelper` from the `demo` module to the `library` module, making it an officially supported utility for Java consumers.
The key changes include:
- Renaming `StreetViewHelper` to `StreetViewJavaHelper` for better clarity and moving it to the `com.google.maps.android` package within the library.
- Migrating the corresponding unit tests from the `demo` to the `library` module and updating them to reflect the class rename.
- Adjusting `build.gradle.kts` files to move test dependencies (`mockk`, `coroutines-test`, `robolectric`) from the `demo` to the `library` module.
- Renaming `StreetViewDemoActivityJava` to `StreetViewDemoJavaActivity` and updating it to use the new helper from the library.
- Improving the warning message for invalid or missing API keys in the demo app.
* refactor: Remove redundant Javadoc in StreetViewDemoJavaActivity
Copy file name to clipboardExpand all lines: demo/src/main/res/values/strings.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -33,5 +33,5 @@
33
33
<stringname="button_radius">Radius</string>
34
34
<stringname="button_gradient">Gradient</string>
35
35
<stringname="button_opacity">Opacity</string>
36
-
<stringname="bad_maps_api_key">Invalid or missing Google Maps API key</string>
36
+
<stringname="bad_maps_api_key">The Google Maps API key looks invalid or is missing. If you are sure your key is correct, you can remove this check from the demo.</string>
0 commit comments