Skip to content

Add support for adaptive samples#476

Open
shubham7109 wants to merge 10 commits intov.nextfrom
samples/adaptive-layout-design
Open

Add support for adaptive samples#476
shubham7109 wants to merge 10 commits intov.nextfrom
samples/adaptive-layout-design

Conversation

@shubham7109
Copy link
Copy Markdown
Collaborator

@shubham7109 shubham7109 commented Apr 21, 2026

Description

PR to add support for building adaptive samples. Introduces a reusable adaptive three-pane scaffold in samples-lib and migrates the Show Exploratory Viewshed From Point In Scene sample to use it.

Links and Data

Sample issue: kotlin/issues/7625

Summary of changes

Generated by co-pilot

  • Introduces AdaptiveThreePane as a reusable adaptive scaffold in samples-lib for a consistent three-layer pattern: main content, supporting pane, and optional floating pane.

  • Migrates the viewshed sample UI to AdaptiveThreePane so 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 AdaptiveThreePane with drag + dismiss behavior, so samples can expose quick actions without taking over the full supporting pane.

  • Updates the sample MainScreen to separate state wiring from content rendering, making preview rendering possible without requiring a live ViewModel path.

  • 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 SceneViewModel to 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:

@shubham7109 shubham7109 changed the title Prototyping sample Add support for adaptive samples Apr 21, 2026
@shubham7109 shubham7109 marked this pull request as ready for review April 23, 2026 22:01
@shubham7109 shubham7109 self-assigned this Apr 23, 2026
@shubham7109 shubham7109 added enhancement New feature or request labels Apr 23, 2026
@shubham7109 shubham7109 requested a review from alan-edi April 27, 2026 15:34
Copy link
Copy Markdown
Collaborator

@alan-edi alan-edi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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):
Image

if (hasUserDraggedSinceLastSettle && previousSettledAnchorIndex != settledAnchorIndex) {
hapticFeedback.performHapticFeedback(HapticFeedbackType.TextHandleMove)
}
previousSettledAnchorIndex = settledAnchorIndex
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AS warns this assigned value never used

hasUserDraggedSinceLastSettle = false
}

SupportingPaneScaffold(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc for floatingPaneInitiallyVisible property missing

*/
@Composable
fun ViewshedOptionsScreen(
fun ViewshedSlidersContent(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it still make sense for this file to be called ViewshedOptionsScreen.kt now this function has been renamed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants