Skip to content

feat: Modernize Android samples UI, edge-to-edge insets, and demo verification improvements - #2389

Draft
dkhawk wants to merge 1 commit into
mainfrom
fix/snippets-null-safety
Draft

feat: Modernize Android samples UI, edge-to-edge insets, and demo verification improvements#2389
dkhawk wants to merge 1 commit into
mainfrom
fix/snippets-null-safety

Conversation

@dkhawk

@dkhawk dkhawk commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR modernizes the Google Maps Platform Android ApiDemos suite with Material 3 components, comprehensive edge-to-edge window inset handling, dark/light theme contrast fixes, state retention bugfixes, and real-time telemetry improvements.

Key Changes

  • Camera Clamping Demo (CameraClampingDemoActivity):
    • Replaced legacy +/- single-step buttons with a dual-thumb Material 3 RangeSlider ([2.0, 21.0], step 0.5).
    • Added Material 3 MaterialButtonToggleGroup for Adelaide, Pacific, and Reset bounds with visible active states.
    • Implemented 60fps real-time camera tracking via GoogleMap.setOnCameraMoveListener.
    • Upgraded telemetry readouts to multiline 6-decimal precision.
    • Fixed IllegalStateException bounds mismatch crash on Reset Zoom.
  • Save State Demo (SaveStateDemoActivity):
    • Fixed cross-orientation marker state restoration by removing conflicting explicit parcel classloader wrappers and setting the correct target layout.
  • Marker Demo (MarkerDemoActivity):
    • Modernized custom info window layouts for high contrast across both Light and Dark system modes.
    • Retained 1.5s Perth bounce animation via main looper handler.
  • Camera Demo (CameraDemoActivity):
    • Fixed incorrect toolbar title resource.
    • Polished 3D camera animations (Sydney / Bondi), custom duration slider, and directional pad.
  • Events Demo (EventsDemoActivity):
    • Added live 60fps OnCameraMoveListener telemetry tracking.
    • Formatted coordinates cleanly to 6 decimal places.
    • Fixed layout height constraint and panel surface styling.
  • Layers Demo (LayersDemoActivity):
    • Initialized camera to Sydney CBD / Martin Place (LatLng(-33.8688, 151.2093), zoom 16.5, tilt 40°) so 3D buildings, traffic overlays, and indoor floorplans are immediately visible.
    • Fixed layer spinner dropdown text truncation for Satellite and Terrain.
    • Upgraded to MaterialCheckBox.
  • System Insets & Edge-to-Edge:
    • Applied consistent system window insets in SamplesBaseActivity across both Kotlin and Java samples.

Comment thread ApiDemos/project/common-ui/src/main/res/layout/marker_demo.xml Fixed
Comment thread ApiDemos/project/common-ui/src/main/res/layout/marker_demo.xml Fixed
map = googleMap
// Center map camera on Pegman's location with street-level zoom
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(markerPosition, 16f))
googleMap.setOnMarkerDragListener(this@SplitStreetViewPanoramaAndMapDemoActivity)
map = googleMap;
// Center map camera on Pegman's location with street-level zoom
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(markerPosition, 16f));
googleMap.setOnMarkerDragListener(SplitStreetViewPanoramaAndMapDemoActivity.this);
Comment thread gradle/libs.versions.toml Fixed
Comment thread ApiDemos/project/common-ui/src/main/res/layout/snapshot_demo.xml Fixed
@dkhawk
dkhawk force-pushed the fix/snippets-null-safety branch 2 times, most recently from e050838 to 692462e Compare August 18, 2026 20:47
… sample reliability

- Edge-to-Edge & System Insets:
  * Updated SamplesBaseActivity (Kotlin & Java) to safely apply window insets to root containers and programmatic layouts without double-insetting nested fragments.
  * Corrected constraints and margins across all demo layouts.

- Split Street View Panorama & Map Demo:
  * Added Material 3 "My Location" Floating Action Button powered by FusedLocationProviderClient (PRIORITY_HIGH_ACCURACY) with runtime permission handling.
  * Added dismissible instruction banner explaining bidirectional sync.
  * Synchronized Pegman marker heading and camera tracking between Map and Panorama.
  * Updated initial camera framing centered on Sydney Harbour with rich docstrings.

- Snapshot Demo Modernization (SnapshotDemoActivity):
  * Redesigned UI with Material 3 cards for capture controls, options, and preview.
  * Added custom vector icons (ic_camera, ic_clear) with Apache 2.0 license headers.
  * Updated initial camera focal point to Venice (45.4371, 12.3345, zoom 16f).
  * Optimized portrait and landscape layouts (layout/ and layout-land/).

- Advanced Markers, Datasets, & Map Overlays:
  * AdvancedMarkersDemoActivity: Added custom framed badge iconView with Android green border and LatLngBounds camera initialization enclosing all Southeast Asia markers.
  * GroundOverlayDemoActivity: Configured LatLngBounds viewport framing and 0.2f initial transparency so underlying map details remain visible.
  * DataDrivenDatasetStylingActivity: Added LatLngBounds with padding to frame dataset features across Kotlin and Java demos.

- Lite List Demo Modernization (LiteListDemoActivity):
  * Redesigned list rows with Material 3 MaterialCardView tiles, rounded corners, elevation, and styled headers with location icon.
  * Added ic_view_list and ic_view_grid vector drawables.
  * Wired MaterialToolbar to support switching between Linear List and 2-column Grid modes.

- Location Source & Core Demos:
  * LocationSourceDemoActivity: Fixed toolbar title to display "Location Source Demo".
  * Verified PolygonDemoActivity, PolylineDemoActivity, and CircleDemoActivity on device.

- Wear OS Sample (com.example.wearos):
  * Added safe exception handling around AmbientModeSupport.attach() in MainActivity and AmbientActivity (Kotlin & Java) to guard against missing wearable shared libraries.
  * Verified circular map and interactive marker info windows on Wear OS emulator.

- Compose (FireMarkers), Snippets, & Tutorials:
  * FireMarkers: Refactored marker position animations with rememberUpdatedMarkerState.
  * Snippets: Fixed null safety and field initialization in KML.kt and Multilayer.kt.
  * Tutorials: Modernized string templates, test runners, and dependencies.
  * Lint & Resources: Resolved lint warnings, replaced hardcoded strings with resource entries, and specified explicit Locales in String.format.
@dkhawk
dkhawk force-pushed the fix/snippets-null-safety branch from 692462e to 1332bdb Compare August 18, 2026 20:50
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.

2 participants