Repository navigation
fix(HillyRoadAlert): add Hilly & Undulating Road Early Alerts sample across Kotlin, Java, and Compose - #98
Open
LoyalAbbas wants to merge 1 commit into
Open
LoyalAbbas wants to merge 1 commit into
LoyalAbbas wants to merge 1 commit into
Conversation
…across Kotlin, Java, and Compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Hilly & Undulating (Roller-Coaster) Road Early Alerts showcase sample with full 3-way parity across Kotlin Views, Java Views, and Jetpack Compose.
This sample demonstrates how 3D elevation route profiles (
LatLngAltitudewith explicitABSOLUTEaltitudes) can be analyzed ahead of a moving vehicle in real time to detect rapid crests, dips, blind summits, and sustained steep climbs/descents before the driver reaches them.Key Features
RoadTerrainAnalyzer):250m,500m,750m) ahead of the vehicle to detect local elevation peaks (CREST) and troughs (DIP) using vertical prominence hysteresis (when (state)state machine).Max Grade: +X.X% / -Y.Y%) and classifies upcoming hazards (UNDULATING_ROLLER_COASTER,BLIND_CREST,STEEP_CLIMB,STEEP_DESCENT,NONE) withCAUTION/WARNINGseverity escalation.HillyRoadAlertViewModel):CAUTIONamber /WARNINGred), crest/dip 3D markers, and the 3D red car marker tracking the route.onMapReady) and gracefully handles offline launches (ACCESS_NETWORK_STATE) so the native Maps 3D offline prompt displays without crashing.ElevationSparklineView/ ComposeCanvas) with vehicle, crest, and dip indicators.Roller-Coaster,Mountain Pass,Coastal), lookahead horizon selector, playback speed (0.5x–5x), and crest camera preview toggle.hilly_routes.json&HillyRouteData):Maps3DSamples/ApiDemos/common/src/main/resources/hilly_routes.jsonand loads them lazily on first access to keep Kotlin sources and.dexstatic initialization lean.Architecture & 3-Way Parity
:Maps3DSamples:ApiDemos:common):RoadTerrainAnalyzer.kt— Pure Kotlin terrain, extrema, grade, sparkline, and advisory speed engine.HillyRouteData.kt&resources/hilly_routes.json— Lazy-loaded 3D route presets.HillyRoadAlertViewModel.kt— UDF presentation state machine exposingStateFlow(Kotlin/Compose) andLiveDataviaasLiveData()(Java) synchronized with hardware frame ticks.ElevationSparklineView.kt&res/layout/activity_hilly_road_alerts.xml— Shared custom sparkline view and Material 3 layout for Kotlin & Java Views.Maps3DSamples/ApiDemos/kotlin-app/.../hillyroadalerts/HillyRoadAlertsActivity.ktMaps3DSamples/ApiDemos/java-app/.../hillyroadalerts/HillyRoadAlertsActivity.javaMaps3DSamples/ComposeDemos/app/.../hillyroadalerts/HillyRoadAlertsActivity.ktTesting & Verification
:Maps3DSamples:ApiDemos:common:RoadTerrainAnalyzerTest.kt— Verifies flat/gentle control routes, earlyCAUTION→WARNINGescalation on undulating terrain, stable crest/dip IDs and grade deltas, sustained climb/blind crest/descent classification, and zero-distance/duplicate-point guards.HillyRoadAlertViewModelTest.kt— VerifiesonMapReadygating, frame-tick progression, route preset switching, horizon updates, scrubbing, and Jump to Hills behavior../gradlew spotlessApply,:Maps3DSamples:ApiDemos:common:testDebugUnitTest, and debug compilation across:Maps3DSamples:ApiDemos:kotlin-app,:Maps3DSamples:ApiDemos:java-app, and:Maps3DSamples:ComposeDemos:app.