feat(samples): add Cloud-Based Map Styling demo - #52
Conversation
There was a problem hiding this comment.
Android Lint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
| <activity android:name=".placedetails.PlaceDetailsActivity" android:exported="true" android:label="Place Details" android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" /> | ||
| <activity android:name=".advancedcameraanimation.AdvancedCameraAnimationActivity" android:exported="true" android:label="Advanced Camera Animation" /> | ||
| <activity android:name=".datavisualization.DataVisualizationActivity" android:exported="true" android:label="Data Visualization" /> | ||
| <activity android:name=".cloudstyling.CloudStylingActivity" android:exported="true" android:label="Cloud Map Styling" /> |
There was a problem hiding this comment.
This has been eliminated from the Manifest, is it intended?
| super.onCreate(savedInstanceState); | ||
|
|
||
| // Set dedicated standalone layout with declarative mapId="9a35234a36da44d2c47bf626" | ||
| setContentView(R.layout.activity_cloud_styling); |
There was a problem hiding this comment.
We are extending SampleBaseActivity, and inside SampleBaseActivity we are already setting the content view.
| import com.google.android.gms.maps3d.model.camera | ||
| import com.google.android.gms.maps3d.model.latLngAltitude | ||
| import com.google.maps.android.SphericalUtil | ||
| import com.google.maps.android.compose3d.GoogleMap3D |
There was a problem hiding this comment.
We are importing two different GoogleMap3Ds here (the class from gms.maps3d and the composable from compose3d), is that intended? Might be worth aliasing one.
|
|
||
| btnPlayPause = findViewById(R.id.btn_play_pause); | ||
| if (btnPlayPause != null) { | ||
| btnPlayPause.setOnClickListener(v -> { |
There was a problem hiding this comment.
Do we need a guard here? cumulativeDistances is only set in onMap3DViewReady, and Frame Dispatcher is the default approach, could tapping Play early NPE?
| return normalized < 0.0 ? normalized + 360.0 : normalized; | ||
| } | ||
|
|
||
| private static double interpolateAngle(double start, double end, double fraction) { |
There was a problem hiding this comment.
startHeading is 105 and endHeading is 465 for the orbit step. Doesn't (465 - 105) % 360 give us 0 here? Wouldn't that pin the camera for the whole step instead of rotating it?
| return if (normalized < 0.0) normalized + 360.0 else normalized | ||
| } | ||
|
|
||
| private fun interpolateAngle(start: Double, end: Double, fraction: Double): Double { |
There was a problem hiding this comment.
Same issue as the Java version. endHeading is startHeading + 360, so diff comes out as 0 and the orbit never actually rotates?
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| enableEdgeToEdge() | ||
| super.onCreate(savedInstanceState) | ||
| setContentView(R.layout.activity_cloud_styling) |
There was a problem hiding this comment.
Same as the Java version. We are extending SampleBaseActivity, and it already sets the content view before we call setContentView again here.
| return if (normalized < 0.0) normalized + 360.0 else normalized | ||
| } | ||
|
|
||
| private fun interpolateAngle(start: Double, end: Double, fraction: Double): Double { |
There was a problem hiding this comment.
Same interpolateAngle issue as the other two flavors. Is the 360° orbit step actually rotating here?
| val currentMax = floodSlider.valueTo.toDouble() | ||
| var newElevation = currentFloodElevation + 0.2 | ||
| newElevation = Math.round(newElevation * 10.0) / 10.0 | ||
| floodSlider.value = newElevation.toFloat() |
There was a problem hiding this comment.
Could this go over valueTo before we check it below? stepSize is 0.1, so if the slider isn't aligned to 0.2 we'd set a value above 100 and crash.
bc43579 to
f817941
Compare
| style="@style/TextAppearance.Material3.LabelLarge" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Map Mode" |
| android:layout_height="wrap_content" | ||
| android:layout_weight="1" | ||
| android:checked="true" | ||
| android:text="Roadmap" |
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:layout_weight="1" | ||
| android:text="Hybrid" |
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:layout_weight="1" | ||
| android:text="Satellite" |
f817941 to
0103ac7
Compare
0103ac7 to
9d16780
Compare
Note
Stacked PR: This pull request is branched off of and based on PR #50 (
feature/new_features_with_0.2.2_sdk). It should be merged after PR #50 is merged.Summary
This draft PR introduces the Cloud-Based Map Styling showcase demo and automated visual testing suite across Java Views, Kotlin Views, and Jetpack Compose (
ApiDemosandComposeDemos).This sample demonstrates configuring a Google Maps 3D view with a custom Cloud Map ID (
mapId) both declaratively (via XML attributes in View-based samples) and programmatically (viaMap3DInitConfigin Jetpack Compose).Status / Current Behavior
Changes Included
Java Views (
ApiDemos):CloudStylingActivity.java: Custom Map ID setup via dedicated layout, supporting dynamic mode toggling between Roadmap, Hybrid, and Satellite.activity_cloud_styling.xml&control_panel_cloud_styling.xml: Declarativemap3d:mapId="9a35234a36da44d2c47bf626"layout integration with interactive Map Mode selector card.CloudStylingVisualTest.java: Automated UI Automator and Gemini visual regression test synchronized viaMapSteadylistener.Kotlin Views (
ApiDemos):CloudStylingActivity.kt: Idiomatic Kotlin View-based implementation with custom Map ID and mode controls.CloudStylingVisualTest.kt: Kotlin UI Automator and Gemini visual regression test.Jetpack Compose (
ComposeDemos):CloudStylingActivity.kt: Full Compose 3D implementation utilizingGoogleMap3Dand explicitMap3DInitConfigconfigured withmapId.MainActivity.kt: Registered Cloud-Based Map Styling in the Compose Demos catalog screen.Tooling & Code Health:
./gradlew spotlessApplywith 4-spacektlintrules../gradlew test assembleDebugand./gradlew spotlessCheck.