Commit e3685c6
authored
chore: demo tile overlay state fix (#769)
* chore(demo): Export all sample activities
Updated the `AndroidManifest.xml` in the `maps-app` sample to set `android:exported="true"` for all sample activities. This change allows each activity to be launched directly, simplifying demonstration and testing.
* feat(maps-app): Group demo activities on main screen
To make the main screen less cluttered and easier to navigate, the demo activities have been grouped into a list. This provides a cleaner and more organized user experience.
This change also pulls in Material 3.
* feat(maps-app): Use Material 3 Scaffold
This commit updates the main screen to use a Material 3 Scaffold, providing a more modern and consistent layout. The TopAppBar has also been updated to be center-aligned.
* refactor(demo): Extract strings and refactor list composables
Refactored the demo list screen to support internationalization by extracting all hardcoded strings into `strings.xml`. The `Activity` and `ActivityGroup` data classes were updated to use `@StringRes` integer IDs instead of `String` literals.
Additionally, the `DemoList` composable has been broken down into smaller, more focused composables (`GroupHeaderItem` and `DemoActivityItem`) to improve readability and maintainability.
* chore(demo): Add copyright header to Demo.kt and clean up unused import
* docs: Improve comment for expanded group state in DemoList
* chore: Add TileOverlay demo activity
This commit introduces a new example activity, `TileOverlayActivity`, to demonstrate the usage and dynamic updating of the `TileOverlay` composable.
The demo showcases:
- Providing custom tiles using a `TileProvider`.
- Refreshing tile content by calling `clearTileCache()` on the `TileOverlayState`. The example updates tiles every second to display an incrementing number.
- Replacing the `TileProvider` instance to trigger a full refresh of the overlay.
The new activity is registered in the manifest and is accessible from the main screen of the demo application.
* feat: Relocate TileOverlayActivity to Demo.kt
The TileOverlayActivity was previously launched from a standalone button in MainActivity. This commit moves it into the "Map Features" group within Demo.kt, ensuring a more consistent and organized user experience.
This change also removes the now-redundant button from MainActivity.
* feat(maps-app): make TileOverlayActivity more idiomatic
* docs: Added detailed comments to the `TileOverlayActivity` sample to better demonstrate how to update a `TileOverlay`.
The `LaunchedEffect` in `TileOverlayDemo` now includes comments explaining two distinct update strategies:
1. **Cache Invalidation**: Calling `state.clearTileCache()` to force a redraw of tiles using the existing `TileProvider`.
2. **Provider Replacement**: Creating a new `TileProvider` instance, which triggers a full replacement of the overlay's data source.1 parent 7321201 commit e3685c6
File tree
4 files changed
+135
-1
lines changed- maps-app/src/main
- java/com/google/maps/android/compose
- res/values
4 files changed
+135
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
| |||
Lines changed: 123 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
78 | | - | |
| 81 | + | |
0 commit comments