Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions LOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

### Task: Implement Monster Tour and Long Press popup (Project: Maps3D Samples)
* **Start:** [Unknown] (Branch: main)
* **End:** $(date +"%I:%M:%S %p %Z")
* **Time Spent:** [Unknown]
* **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.
* **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.
* **Status:** **[IN PROGRESS (Unmerged)]**
4 changes: 2 additions & 2 deletions Maps3DSamples/ApiDemos/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ dependencies {

implementation(libs.androidx.material3)

api(libs.play.services.base)
api(libs.play.services.maps3d)
api(libs.play.services.base) // "com.google.android.gms:play-services-base:18.10.0"
api(libs.play.services.maps3d) // "com.google.android.gms:play-services-maps3d:0.2.0"
}
130 changes: 130 additions & 0 deletions Maps3DSamples/ApiDemos/common/src/main/assets/monsters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
[
{
"id": "alien",
"label": "Devil's Tower Alien",
"blurb": "They didn't just come to sculpt mashed potatoes.",
"drawable": "alien",
"latitude": 44.589994,
"longitude": -104.715326,
"altitude": 1508.9,
"markerLatitude": 44.59054845363309,
"markerLongitude": -104.715177415273,
"markerAltitude": 10.0,
"heading": 1.0,
"tilt": 75.0,
"range": 1635.0,
"altitudeMode": "RELATIVE_TO_MESH"
},
{
"id": "bigfoot",
"label": "Mt. St. Helens Bigfoot",
"blurb": "Leaves some pretty big footprints, very camera shy.",
"drawable": "bigfoot",
"latitude": 46.199837,
"longitude": -122.205541,
"altitude": 2272.5,
"markerLatitude": 46.199837,
"markerLongitude": -122.205541,
"markerAltitude": 2272.5,
"heading": 318.0,
"tilt": 58.0,
"range": 6088.0,
"altitudeMode": "ABSOLUTE"
},
{
"id": "frank",
"label": "Castle Frankenstein",
"blurb": "It's alive! Quite misunderstood, honestly.",
"drawable": "frank",
"latitude": 49.793566,
"longitude": 8.669903,
"altitude": 380.1,
"markerLatitude": 49.793570448322434,
"markerLongitude": 8.668253367313627,
"markerAltitude": 100.0,
"heading": 90.0,
"tilt": 45.0,
"range": 1246.0,
"altitudeMode": "RELATIVE_TO_MESH"
},
{
"id": "godzilla",
"label": "Tokyo Bay Godzilla",
"blurb": "King of the Monsters. Loves a quick swim in the bay.",
"drawable": "godzilla",
"latitude": 35.5391,
"longitude": 139.8001,
"altitude": 100.0,
"markerLatitude": 35.5391,
"markerLongitude": 139.8001,
"markerAltitude": 100.0,
"heading": 0.0,
"tilt": 60.0,
"range": 3000.0,
"altitudeMode": "RELATIVE_TO_GROUND"
},
{
"id": "mothra",
"label": "Tokyo Tower Mothra",
"blurb": "Like a butterfly, but much, much bigger. Attracted to bright lights.",
"drawable": "mothra",
"latitude": 35.658588,
"longitude": 139.745496,
"altitude": 247.9,
"markerLatitude": 35.658588,
"markerLongitude": 139.745496,
"markerAltitude": 333.0,
"heading": 270.0,
"tilt": 48.0,
"range": 810.0,
"altitudeMode": "RELATIVE_TO_GROUND"
},
{
"id": "mummy",
"label": "Giza Mummy",
"blurb": "Woke up on the wrong side of the sarcophagus.",
"drawable": "mummy",
"latitude": 29.9792,
"longitude": 31.1342,
"altitude": 150.0,
"markerLatitude": 29.9792,
"markerLongitude": 31.1342,
"markerAltitude": 150.0,
"heading": 45.0,
"tilt": 60.0,
"range": 1500.0,
"altitudeMode": "ABSOLUTE"
},
{
"id": "nessie",
"label": "Loch Ness Monster",
"blurb": "The original cryptid. Probably just a log, but we want to believe.",
"drawable": "nessie",
"latitude": 57.320312,
"longitude": -4.43019,
"altitude": 14.4,
"markerLatitude": 57.320312,
"markerLongitude": -4.43019,
"markerAltitude": 14.4,
"heading": 0.0,
"tilt": 45.0,
"range": 20303.0,
"altitudeMode": "ABSOLUTE"
},
{
"id": "yeti",
"label": "Everest Yeti",
"blurb": "Abominable? More like adorable if you get to know him.",
"drawable": "yeti",
"latitude": 27.9881,
"longitude": 86.925,
"altitude": 8848.0,
"markerLatitude": 27.9881,
"markerLongitude": 86.925,
"markerAltitude": 8848.0,
"heading": 0.0,
"tilt": 46.0,
"range": 5000.0,
"altitudeMode": "ABSOLUTE"
}
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:radius="24dp" />
<stroke android:width="1dp" android:color="?attr/colorControlHighlight" />
</shape>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -69,86 +69,119 @@
app:layout_constraintTop_toTopOf="parent"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/reset_view_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
<!-- Floating Pill Control Bar (HorizontalScrollView) -->
<HorizontalScrollView
android:id="@+id/control_scroll_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:icon="@drawable/restart_alt_24px"
android:contentDescription="@string/reset_view"
android:visibility="gone"
/>
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:scrollbars="none"
android:clipToPadding="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">

<com.google.android.material.button.MaterialButton
android:id="@+id/snapshot_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/photo_camera_24px"
android:contentDescription="@string/snapshot_camera"
android:visibility="gone"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@drawable/pill_background"
android:padding="8dp">

<com.google.android.material.button.MaterialButton
android:id="@+id/stop_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/stop_24px"
android:contentDescription="@string/stop_camera"
android:visibility="gone"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/tour_monsters_button"
style="@style/Widget.Material3.Button.TonalButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="0dp"
android:insetBottom="0dp"
android:insetTop="0dp"
android:alpha="0.4"
android:text="🗺️"

Check warning

Code scanning / Android Lint

Hardcoded text Warning

Hardcoded string "🗺️", should use @string resource
android:textSize="20sp"
android:contentDescription="@string/tour_monsters"
android:visibility="gone"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/fly_berlin_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/public_24px"
android:contentDescription="Fly to Berlin"
android:visibility="gone"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/fly_random_monster_button"
style="@style/Widget.Material3.Button.TonalButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="0dp"
android:insetBottom="0dp"
android:insetTop="0dp"
android:alpha="0.4"
android:text="🎲"

Check warning

Code scanning / Android Lint

Hardcoded text Warning

Hardcoded string "🎲", should use @string resource
android:textSize="20sp"
android:contentDescription="Fly to Random Monster"

Check warning

Code scanning / Android Lint

Hardcoded text Warning

Hardcoded string "Fly to Random Monster", should use @string resource
android:visibility="gone"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/fly_nyc_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/location_city_24px"
android:contentDescription="Fly to NYC"
android:visibility="gone"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/fly_berlin_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:icon="@drawable/public_24px"
android:contentDescription="Fly to Berlin"

Check warning

Code scanning / Android Lint

Hardcoded text Warning

Hardcoded string "Fly to Berlin", should use @string resource
android:visibility="gone"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/fly_tokyo_button"
style="@style/Widget.Material3.Button.TonalButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="0dp"
android:insetBottom="0dp"
android:insetTop="0dp"
android:alpha="0.2"
android:text="🦖"
android:textSize="20sp"
android:contentDescription="Fly to Tokyo"
android:visibility="gone"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/fly_nyc_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:icon="@drawable/location_city_24px"
android:contentDescription="Fly to NYC"

Check warning

Code scanning / Android Lint

Hardcoded text Warning

Hardcoded string "Fly to NYC", should use @string resource
android:visibility="gone"
/>

<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/button_flow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintEnd_toEndOf="@+id/map3dView"
app:layout_constraintBottom_toBottomOf="@+id/map3dView"
app:flow_wrapMode="chain"
app:flow_horizontalStyle="packed"
app:flow_horizontalBias="0"
app:flow_horizontalGap="8dp"
app:constraint_referenced_ids="fly_tokyo_button,fly_berlin_button,fly_nyc_button,stop_button,reset_view_button,snapshot_button"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/stop_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:icon="@drawable/stop_24px"
android:contentDescription="@string/stop_camera"
android:visibility="gone"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/reset_view_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:icon="@drawable/restart_alt_24px"
android:contentDescription="@string/reset_view"
android:visibility="gone"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/snapshot_button"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/photo_camera_24px"
android:contentDescription="@string/snapshot_camera"
android:visibility="gone"
/>

</LinearLayout>
</HorizontalScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
12 changes: 12 additions & 0 deletions Maps3DSamples/ApiDemos/common/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,16 @@
<string name="polygon_zoo_clicked">Zoo time</string>
<string name="polyline_trail_clicked">Hiking time!</string>
<string name="model_plane_clicked">Model clicked</string>

<!-- Monster Blurbs -->
<string name="monster_alien_blurb">They didn\'t just come to sculpt mashed potatoes. 👽</string>
<string name="monster_bigfoot_blurb">Leaves some pretty big footprints, very camera shy. 👣</string>
<string name="monster_frank_blurb">It\'s alive! Quite misunderstood, honestly. ⚡</string>
<string name="monster_godzilla_blurb">King of the Monsters. Loves a quick swim in the bay. 🦖</string>
<string name="monster_mothra_blurb">Like a butterfly, but much, much bigger. Attracted to bright lights. 🦋</string>
<string name="monster_mummy_blurb">Woke up on the wrong side of the sarcophagus. ⚰️</string>
<string name="monster_nessie_blurb">The original cryptid. Probably just a log, but we want to believe. 🦕</string>
<string name="monster_yeti_blurb">Abominable? More like adorable if you get to know him. 🏔️</string>
<string name="monster_ape_blurb">I am a Giant Ape! 🦍</string>
<string name="tour_monsters">Tour Monsters</string>
</resources>
Loading
Loading