refactor(samples): polish 0.2.2 showcase samples with collapsible UI, auto-fade, and literate docs - #54
Conversation
- Advanced Camera Animation: - Add modular step animation pipeline (FlyToStep, OrbitStep, DwellStep, FlyAroundStep, KeyframeStep). - Add high-altitude San Francisco starting camera view. - Implement full reset and continuous orbit support. - Sync Java, Kotlin, and Jetpack Compose implementations. - Path Following: - Implement two-polyline progress tracking with wide blue base route (lower z-index) and narrow purple progress route (higher z-index). - Use in-place fixed polyline IDs to eliminate rendering flickering. - Default altitude mode to 'Clamp to Ground' with support for Relative to Ground, Relative to Mesh, and Absolute. - Add dynamic path height slider to avoid z-fighting with terrain. - Add collapsible control panel with explicit collapse/expand button, auto-slide dismissal, and subtle idle opacity. - Extract all hardcoded strings into strings.xml resources. - Align Java and Kotlin implementations.
…n with collapsible cards and literate docs
…, auto-fade, and literate docs
| lastTimeNanos = frameTimeNanos | ||
|
|
||
| val stepDistance = followSpeedMps * dt | ||
| val stepDistance = followSpeedMps * (frameDurationMs / 1000.0) |
There was a problem hiding this comment.
Assuming a fixed 16ms (frameDurationMs) can cause speed drift under frame drops or on displays with variable/higher refresh rates (90Hz / 120Hz).
Consider measuring actual elapsed wall-clock delta time dt = (now - lastTime) / 1000.0 (as done in RoutesActivity.kt):
val now = System.currentTimeMillis()
val dt = (now - lastTime) / 1000.0
lastTime = now
elapsedDistance += followSpeedMps * dtThere was a problem hiding this comment.
Fixed in 4e290f3! Integrated wall-clock delta time (dt = (now - lastTime) / 1000.0) across both Kotlin and Java PathFollowingActivity implementations.
| private void run360OrbitSpin() { | ||
| stopTour(); | ||
| isPlaying = true; | ||
| private void pauseTour() { |
There was a problem hiding this comment.
When pauseTour() is called here and the user later clicks Play to unpause, startOrResumeTour() invokes tourAnimator.start(googleMap3D, ...) which resets currentStepIndex = 0 and restarts the tour from Step 1 instead of resuming.
Consider checking whether to resume or start:
if (tourAnimator == null) {
tourAnimator = buildTourAnimator();
tourAnimator.start(googleMap3D, animatorListener);
} else if (tourAnimator.getCurrentStepIndex() < tourAnimator.getSteps().size()) {
tourAnimator.resume();
} else {
tourAnimator.start(googleMap3D, animatorListener);
}There was a problem hiding this comment.
Fixed in 4e290f3! Updated startOrResumeTour() to resume an in-progress tour via tourAnimator.resume() instead of restarting from Step 1.
|
|
||
| override fun onDestroy() { | ||
| stopSimulation() | ||
| fadeHandler.removeCallbacks(fadeOutRunnable) |
There was a problem hiding this comment.
Consider adding onPause() to call stopSimulation() and fadeHandler.removeCallbacks(fadeOutRunnable).
Currently, if the user backgrounds the app, answers a phone call, or locks the device, the simulation coroutine loop continues running and triggering 3D polygon redraws in the background until the Activity is destroyed.
There was a problem hiding this comment.
Fixed in 4e290f3! Added onPause() override in both Kotlin and Java DataVisualizationActivity implementations to stop the simulation and clean up fade callbacks.
| fadeHandler.postDelayed(fadeOutRunnable, 3000L) | ||
| } | ||
|
|
||
| private fun collapseControls() { |
There was a problem hiding this comment.
In FieldOfViewActivity and RoadmapModeActivity, collapsing is handled smoothly via TransitionManager.beginDelayedTransition(card) and toggling content.visibility = GONE / VISIBLE.
Consider adopting the same approach here instead of calculating translationY and display density manually. It simplifies the code and automatically adapts to varying screen sizes.
There was a problem hiding this comment.
Fixed in 4e290f3! Standardized to TransitionManager.beginDelayedTransition(card) and cardContent.visibility = GONE / VISIBLE across both Kotlin and Java DataVisualizationActivity.
…sume, onPause, and TransitionManager collapse
…llowing, Data Viz, Roadmap Mode, FOV) (#50) * Add sample demos for Cloud Styling, Roadmap Mode, Data Visualization, Field of View, Path Following, and Advanced Camera Animation * feat(samples): polish 0.2.2 showcase features and apply spotless formatting - Add showcase demos for Advanced Camera Animation, Path Following, Data Visualization, Roadmap Mode, and Field of View - Synchronize hardware frame loops to VSYNC and improve touch-fade UX - Format codebase using spotless to adhere to 4-space ktlint rules * test(visual): optimize visual test synchronization using MapSteady listener * fix(compose): preserve Cloud Styling skeleton placeholder to match main baseline * feat(compose): implement Data Visualization (Flood Fill) demo in ComposeDemos * refactor(samples): polish 0.2.2 showcase samples with collapsible UI, auto-fade, and literate docs (#54) * Enhance Advanced Camera Animation and Path Following samples - Advanced Camera Animation: - Add modular step animation pipeline (FlyToStep, OrbitStep, DwellStep, FlyAroundStep, KeyframeStep). - Add high-altitude San Francisco starting camera view. - Implement full reset and continuous orbit support. - Sync Java, Kotlin, and Jetpack Compose implementations. - Path Following: - Implement two-polyline progress tracking with wide blue base route (lower z-index) and narrow purple progress route (higher z-index). - Use in-place fixed polyline IDs to eliminate rendering flickering. - Default altitude mode to 'Clamp to Ground' with support for Relative to Ground, Relative to Mesh, and Absolute. - Add dynamic path height slider to avoid z-fighting with terrain. - Add collapsible control panel with explicit collapse/expand button, auto-slide dismissal, and subtle idle opacity. - Extract all hardcoded strings into strings.xml resources. - Align Java and Kotlin implementations. * feat(fieldofview,datavisualization): polish FOV and Data Visualization with collapsible cards and literate docs * feat(roadmapmode): polish Roadmap Mode with collapsible header and literate docs * feat(routes): polish Routes API sample with collapsible control panel, auto-fade, and literate docs * docs(samples): augment literate comments explaining 3D coordinates, extrusion, and smoothing * build: untrack and gitignore gradle-daemon-jvm.properties * docs: update copyright headers to 2026 for camera animation step classes * fix(samples): address PR review feedback on animation timing, tour resume, onPause, and TransitionManager collapse * fix(lint): resolve github-advanced-security warnings for text size, layout hierarchy, and KTX color parsing (#55) * refactor(path-following): clean MVVM architecture, custom 3D gesture engine, and modern UI controls (#58) * refactor(path-following): clean MVVM architecture, custom 3D gesture engine, and modern UI controls * test(path-following): add unit test suites for PathEngine and PathFollowingViewModel * refactor(path-following): clean PathPlaybackState data class and remove unused strings * refactor(camera): declarative keyframe tour, reverse-trig stationary tracking & 3-way framework parity (#59) * feat(camera): implement declarative keyframe tour with reverse-trig stationary tracking - Implement StationaryCameraTracker math controller with ENU inverse spherical trigonometry for fixed-vantage camera tracking - Add 5-step keyframe queue tour (high-altitude swoop, dwell pause, 360 orbit, stationary vantage tracking flight, and native flyTo transition to Coit Tower) - Modernize UI controls with Material 3 dropdown menu button and structured HTML help dialog across Kotlin Views, Java Views, and Jetpack Compose - Ensure consistent glTF model coordinate alignment, midpoint jump teleportation, and post-flight destination persistence - Add comprehensive unit test coverage with Google Truth assertions across domain controllers * fix(camera): synchronize UI state across frameworks and add framework subtitles - Add framework indicator subtitles (Kotlin Views, Java Views, Jetpack Compose) to control panel headers and top toolbars - Fix LiveData approach button label and sub-options observation in Java Views Activity - Correct chase camera heading for High-Rate Frame Dispatcher to follow flight path bearing (106.2°) - Add delayed onMap3DViewReady initialization workaround to ensure reliable initial camera and entity setup * docs(camera): document onMap3DViewReady initialization delay workaround * docs(camera): clean KDoc math formatting for Android Studio and Dokka compatibility --------- Co-authored-by: Dale Hawkins <107309+dkhawk@users.noreply.github.com> * fix(lint): resolve StringFormatInvalid and SuspiciousIndentation warnings * fix(lint): resolve version catalog, hardcoded text, and accessibility warnings * feat(branding): add framework-specific Google Maps 3D launcher icons for Kotlin, Java, and Compose --------- Co-authored-by: Dale Hawkins <107309+dkhawk@users.noreply.github.com>
Note
Stacked PR: This pull request is branched off of and targets PR #50 (
feature/new_features_with_0.2.2_sdk). It contains reviews, UX refinements, and literate programming enhancements for the 0.2.2 showcase samples.Summary
This pull request provides comprehensive polish, UI consistency, and literate programming documentation across the Google Maps 3D 0.2.2 showcase samples in Java and Kotlin:
Routes API (
RoutesActivity):control_panel_routes.xmloverlay onactivity_common_map.xml.TransitionManager), 3-second touch-aware idle auto-fade, andtoValidCamerabounds enforcement.Roadmap Mode (
RoadmapModeActivity):ROADMAP,HYBRID,SATELLITE).Field of View (
FieldOfViewActivity) & Data Visualization (DataVisualizationActivity):15°to120°), focal length presets, collapsible header, auto-fade. Verified on device.Advanced Camera Animation (
AdvancedCameraAnimationActivity) & Path Following (PathFollowingActivity):FlyToStep,DwellStep,OrbitStep,KeyframeStep), collapsible status card.Code Health & Verification
./gradlew spotlessCheck../gradlew test assembleDebug.