Skip to content

Commit 9505705

Browse files
authored
feat(samples): implement additional maker customization samples (#29)
* feat(samples): implement monster tour, long-press, and altitude modes - Replaced hardcoded markers with dynamic parsing from monsters.json - Implemented automated sequential tour of all markers in Kotlin and Java - Added a long-press PopupMenu to the Random Monster button for quick selection - Configured individual AltitudeModes for markers via JSON * refactor(java): use formal imports instead of fully qualified class names * feat(sample): refactor monster data parsing and implement robust test suite - Extracted JSON parsing logic into dedicated `Monster` and `MonsterParser` classes for both Kotlin and Java apps to clean up activity bloat. - Refactored `MarkersActivity` in both languages to utilize the new abstractions. - Fixed a timing bug in the Java `MarkersActivity` by ensuring `setMapMode` and marker placements await `setOnMapReadyListener`, aligning its behavior with the Kotlin implementation. - Added comprehensive unit tests for the parsing logic. - Added Robolectric integration tests to validate complex asset parsing in an emulated environment. - Migrated all test assertions to Google Truth (`com.google.truth:truth`) for better readability. - Added necessary test dependencies (Robolectric, Truth, JSON) to the relevant Version Catalogs. * fix(samples): synchronize tour with steady map state and add tour cancellation - Implement double-wait pattern utilizing OnMapSteadyListener to prevent tour animations from skipping past unrendered terrain. - Added stopMonsterTour calls to all other navigation buttons. * feat(samples): port missing popovers and map interaction samples to Java * test(mainactivity): add tests verifying all samples present in launcher list * feat(samples): disable auto-panning for Giant Ape popover * style: minor formatting and UI opacity tweaks * refactor(samples): introduce Coroutine extensions for Maps 3D callbacks * docs(samples): add educational comments to Java markers sample * refactor(samples): convert long literals to Duration inWholeMilliseconds * refactor(samples): introduce CompletableFuture extensions for Java app * fix(samples): ensure map steady is awaited after camera flight completes in Java * docs(samples): add extensive inline comments to Java CompletableFuture chain * Address review comments: remove FQDN and extract text content descriptions
1 parent 08868c6 commit 9505705

39 files changed

Lines changed: 1987 additions & 190 deletions

File tree

LOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
### Task: Implement Monster Tour and Long Press popup (Project: Maps3D Samples)
3+
* **Start:** [Unknown] (Branch: main)
4+
* **End:** $(date +"%I:%M:%S %p %Z")
5+
* **Time Spent:** [Unknown]
6+
* **Purpose:** The user wanted to automate the traversal of the various monster markers in the map, and add a quick-select popup menu to the random button, configuring properties like altitude mode via JSON.
7+
* **Summary of Work:** Shifted marker definitions to a central `monsters.json` data file. Implemented an asynchronous touring sequence in both Kotlin (Coroutines) and Java (Handlers) to fly to, orbit, and display info popovers for each character. Wired up a standard `android.widget.PopupMenu` for the random button long-press. Adjusted altitude modes in JSON.
8+
* **Status:** **[IN PROGRESS (Unmerged)]**

Maps3DSamples/ApiDemos/common/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ dependencies {
6969

7070
implementation(libs.androidx.material3)
7171

72-
api(libs.play.services.base)
73-
api(libs.play.services.maps3d)
72+
api(libs.play.services.base) // "com.google.android.gms:play-services-base:18.10.0"
73+
api(libs.play.services.maps3d) // "com.google.android.gms:play-services-maps3d:0.2.0"
7474
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
[
2+
{
3+
"id": "alien",
4+
"label": "Devil's Tower Alien",
5+
"blurb": "They didn't just come to sculpt mashed potatoes.",
6+
"drawable": "alien",
7+
"latitude": 44.589994,
8+
"longitude": -104.715326,
9+
"altitude": 1508.9,
10+
"markerLatitude": 44.59054845363309,
11+
"markerLongitude": -104.715177415273,
12+
"markerAltitude": 10.0,
13+
"heading": 1.0,
14+
"tilt": 75.0,
15+
"range": 1635.0,
16+
"altitudeMode": "RELATIVE_TO_MESH"
17+
},
18+
{
19+
"id": "bigfoot",
20+
"label": "Mt. St. Helens Bigfoot",
21+
"blurb": "Leaves some pretty big footprints, very camera shy.",
22+
"drawable": "bigfoot",
23+
"latitude": 46.199837,
24+
"longitude": -122.205541,
25+
"altitude": 2272.5,
26+
"markerLatitude": 46.199837,
27+
"markerLongitude": -122.205541,
28+
"markerAltitude": 2272.5,
29+
"heading": 318.0,
30+
"tilt": 58.0,
31+
"range": 6088.0,
32+
"altitudeMode": "ABSOLUTE"
33+
},
34+
{
35+
"id": "frank",
36+
"label": "Castle Frankenstein",
37+
"blurb": "It's alive! Quite misunderstood, honestly.",
38+
"drawable": "frank",
39+
"latitude": 49.793566,
40+
"longitude": 8.669903,
41+
"altitude": 380.1,
42+
"markerLatitude": 49.793570448322434,
43+
"markerLongitude": 8.668253367313627,
44+
"markerAltitude": 100.0,
45+
"heading": 90.0,
46+
"tilt": 45.0,
47+
"range": 1246.0,
48+
"altitudeMode": "RELATIVE_TO_MESH"
49+
},
50+
{
51+
"id": "godzilla",
52+
"label": "Tokyo Bay Godzilla",
53+
"blurb": "King of the Monsters. Loves a quick swim in the bay.",
54+
"drawable": "godzilla",
55+
"latitude": 35.5391,
56+
"longitude": 139.8001,
57+
"altitude": 100.0,
58+
"markerLatitude": 35.5391,
59+
"markerLongitude": 139.8001,
60+
"markerAltitude": 100.0,
61+
"heading": 0.0,
62+
"tilt": 60.0,
63+
"range": 3000.0,
64+
"altitudeMode": "RELATIVE_TO_GROUND"
65+
},
66+
{
67+
"id": "mothra",
68+
"label": "Tokyo Tower Mothra",
69+
"blurb": "Like a butterfly, but much, much bigger. Attracted to bright lights.",
70+
"drawable": "mothra",
71+
"latitude": 35.658588,
72+
"longitude": 139.745496,
73+
"altitude": 247.9,
74+
"markerLatitude": 35.658588,
75+
"markerLongitude": 139.745496,
76+
"markerAltitude": 333.0,
77+
"heading": 270.0,
78+
"tilt": 48.0,
79+
"range": 810.0,
80+
"altitudeMode": "RELATIVE_TO_GROUND"
81+
},
82+
{
83+
"id": "mummy",
84+
"label": "Giza Mummy",
85+
"blurb": "Woke up on the wrong side of the sarcophagus.",
86+
"drawable": "mummy",
87+
"latitude": 29.9792,
88+
"longitude": 31.1342,
89+
"altitude": 150.0,
90+
"markerLatitude": 29.9792,
91+
"markerLongitude": 31.1342,
92+
"markerAltitude": 150.0,
93+
"heading": 45.0,
94+
"tilt": 60.0,
95+
"range": 1500.0,
96+
"altitudeMode": "ABSOLUTE"
97+
},
98+
{
99+
"id": "nessie",
100+
"label": "Loch Ness Monster",
101+
"blurb": "The original cryptid. Probably just a log, but we want to believe.",
102+
"drawable": "nessie",
103+
"latitude": 57.320312,
104+
"longitude": -4.43019,
105+
"altitude": 14.4,
106+
"markerLatitude": 57.320312,
107+
"markerLongitude": -4.43019,
108+
"markerAltitude": 14.4,
109+
"heading": 0.0,
110+
"tilt": 45.0,
111+
"range": 20303.0,
112+
"altitudeMode": "ABSOLUTE"
113+
},
114+
{
115+
"id": "yeti",
116+
"label": "Everest Yeti",
117+
"blurb": "Abominable? More like adorable if you get to know him.",
118+
"drawable": "yeti",
119+
"latitude": 27.9881,
120+
"longitude": 86.925,
121+
"altitude": 8848.0,
122+
"markerLatitude": 27.9881,
123+
"markerLongitude": 86.925,
124+
"markerAltitude": 8848.0,
125+
"heading": 0.0,
126+
"tilt": 46.0,
127+
"range": 5000.0,
128+
"altitudeMode": "ABSOLUTE"
129+
}
130+
]
20.5 KB
Loading
21.5 KB
Loading
27.6 KB
Loading

Maps3DSamples/ApiDemos/common/src/main/res/drawable/gz.png renamed to Maps3DSamples/ApiDemos/common/src/main/res/drawable/godzilla.png

File renamed without changes.
28.8 KB
Loading
22.6 KB
Loading
20.3 KB
Loading

0 commit comments

Comments
 (0)