Skip to content

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

Draft
dkhawk wants to merge 4 commits 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 4 commits 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.

dkhawk added 2 commits August 17, 2026 15:19
…ML and Multilayer snippets

- Use safe fallback `?: ""` instead of force-unwrap `!!` when accessing KML container properties.
- Use `lateinit var` for map and context fields in Multilayer snippet to eliminate unnecessary nullable assertions (`!!`).
…ion improvements

- Modernize CameraClampingDemo with Material 3 RangeSlider, clamp toggle group, and live camera telemetry
- Fix SaveStateDemoActivity parcelable state retention across orientations
- Improve dark/light theme contrast and custom InfoWindow layouts in MarkerDemoActivity
- Add 60fps OnCameraMoveListener and clean coordinate formatting in EventsDemoActivity and CameraClampingDemoActivity
- Initialize LayersDemoActivity to Sydney CBD with visible 3D buildings, traffic, and indoor floorplans
- Apply edge-to-edge window insets consistently across 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
tapTextView.text = "tapped, point=$point"
val lat = String.format(Locale.US, "%.6f", point.latitude)
val lng = String.format(Locale.US, "%.6f", point.longitude)
tapTextView.text = "Tapped: ($lat, $lng)"
tapTextView.text = "tapped, point=$point"
val lat = String.format(Locale.US, "%.6f", point.latitude)
val lng = String.format(Locale.US, "%.6f", point.longitude)
tapTextView.text = "Tapped: ($lat, $lng)"
tapTextView.text = "long pressed, point=$point"
val lat = String.format(Locale.US, "%.6f", point.latitude)
val lng = String.format(Locale.US, "%.6f", point.longitude)
tapTextView.text = "Long pressed: ($lat, $lng)"
tapTextView.text = "long pressed, point=$point"
val lat = String.format(Locale.US, "%.6f", point.latitude)
val lng = String.format(Locale.US, "%.6f", point.longitude)
tapTextView.text = "Long pressed: ($lat, $lng)"
val zoom = String.format(Locale.US, "%.1f", pos.zoom)
val tilt = String.format(Locale.US, "%.1f", pos.tilt)
val bearing = String.format(Locale.US, "%.1f", pos.bearing)
cameraTextView.text = "Position: ($lat, $lng)\nzoom=$zoom, tilt=$tilt°, bearing=$bearing°"

override fun onStreetViewPanoramaChange(location: StreetViewPanoramaLocation) {
panoChangeTimesTextView.text = "Times panorama changed=" + ++panoChangeTimes
panoChangeTimesTextView.text = "Times panorama changed=${++panoChangeTimes}"

override fun onStreetViewPanoramaCameraChange(camera: StreetViewPanoramaCamera) {
panoCameraChangeTextView.text = "Times camera changed=" + ++panoCameraChangeTimes
panoCameraChangeTextView.text = "Times camera changed=${++panoCameraChangeTimes}"

override fun onStreetViewPanoramaCameraChange(camera: StreetViewPanoramaCamera) {
panoCameraChangeTextView.text = "Times camera changed=" + ++panoCameraChangeTimes
panoCameraChangeTextView.text = "Times camera changed=${++panoCameraChangeTimes}"
point?.let {
panoClickTimes++
panoClickTextView.text = "Times clicked=$panoClickTimes : $point"
panoClickTextView.text = "Times clicked=$panoClickTimes : $it"
point?.let {
panoClickTimes++
panoClickTextView.text = "Times clicked=$panoClickTimes : $point"
panoClickTextView.text = "Times clicked=$panoClickTimes : $it"
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