Add support for adaptive samples#476
Conversation
alan-edi
left a comment
There was a problem hiding this comment.
@shubham7109 Looks very good, and your use of it for the Show Exploratory Viewshed From Point In Scene sample is excellent! A few minor comments below. Also, I think:
- In the sample's
README.md, How to use the sample should be updated to mention the Scene Options. - The screenshot should come from a tablet in landscape orientation, so we can see the sliders alongside the Scene, something like the following (probably needs just a little trimmed off the height to give it a 700x400 aspect ratio):
| if (hasUserDraggedSinceLastSettle && previousSettledAnchorIndex != settledAnchorIndex) { | ||
| hapticFeedback.performHapticFeedback(HapticFeedbackType.TextHandleMove) | ||
| } | ||
| previousSettledAnchorIndex = settledAnchorIndex |
There was a problem hiding this comment.
AS warns this assigned value never used
| hasUserDraggedSinceLastSettle = false | ||
| } | ||
|
|
||
| SupportingPaneScaffold( |
There was a problem hiding this comment.
AS warns "Calling a androidx.compose.ui.UiComposable composable function where a UI Composable composable was expected" here.
Also several more of this warning below, inside mainPane and supportingPane, but I'll mention only this one.
| * | ||
| * @property supportingPaneInitiallyOpen Whether the supporting pane starts open on first composition. | ||
| * @property floatingPane Configuration for initial position and drag behavior of the floating pane. | ||
| * @property compactSupportingPaneHeightRatio Height ratio used for supporting pane when compact-stacked. |
There was a problem hiding this comment.
Doc for floatingPaneInitiallyVisible property missing
| */ | ||
| @Composable | ||
| fun ViewshedOptionsScreen( | ||
| fun ViewshedSlidersContent( |
There was a problem hiding this comment.
Does it still make sense for this file to be called ViewshedOptionsScreen.kt now this function has been renamed?
Description
PR to add support for building adaptive samples. Introduces a reusable adaptive three-pane scaffold in
samples-liband migrates the Show Exploratory Viewshed From Point In Scene sample to use it.Links and Data
Sample issue:
kotlin/issues/7625Summary of changes
Introduces
AdaptiveThreePaneas a reusable adaptive scaffold insamples-libfor a consistent three-layer pattern: main content, supporting pane, and optional floating pane.Migrates the viewshed sample UI to
AdaptiveThreePaneso layout behavior is responsive across phone, foldable, tablet, and larger widths without per-sample layout duplication.Adds pane state behavior in
AdaptiveThreePane(open/close/toggle + restore anchors) to make supporting pane interactions predictable and easier to reuse in other samples.Adds floating widget support in
AdaptiveThreePanewith drag + dismiss behavior, so samples can expose quick actions without taking over the full supporting pane.Updates the sample
MainScreento separate state wiring from content rendering, making preview rendering possible without requiring a liveViewModelpath.Refactors sample screen composition to pass callbacks/values into scaffold content instead of tightly coupling UI to
SceneViewModel, improving testability and previewability.Updates viewshed controls to be ViewModel-driven and added reset behavior in
SceneViewModelto restore viewshed options and animate back to the configured initial camera/viewpoint.Adds preview-safe behavior by avoiding ArcGIS runtime object creation in preview composition paths, preventing renderer issues in Compose preview.
Adds reusable multi-device light/dark preview annotation (
@SampleDeviceLightDarkPreview) so sample screens can opt into a standard adaptive previews with minimal boilerplate.Docs and resources: