Skip to content

Support 2-pane list detail layout for sample app on larger screens#344

Open
adi-gnm wants to merge 7 commits intomainfrom
ab/support-2-pane-layout
Open

Support 2-pane list detail layout for sample app on larger screens#344
adi-gnm wants to merge 7 commits intomainfrom
ab/support-2-pane-layout

Conversation

@adi-gnm
Copy link
Member

@adi-gnm adi-gnm commented Mar 13, 2026

Description

Add support for larger screens in sample app.

Uses the ListDetailSceneStrategy from Material 3 adaptive for 2 pane support. All key changes are in MainActivity.

  1. Added the ListDetailSceneStrategy to NavDisplay
  2. Added list/detail pane metadata to all entries
  3. Added backhandler to all detail entries
  4. Added a directive to the scene strategy so we use single pane on smaller devices and when only home entry is displaying
  5. Removed custom transition animations as ListDetailSceneStrategy already includes the same horizontal slide transitions

Testing notes/instructions:

Use a foldable, tablet or landscape phone to test.

  1. Confirm that the home screen displays in single pane
  2. Click on one of the buttons
  3. Confirm that the button's screen opens in a detail pane on the right
  4. Press back
  5. Confirm that the home screen again displays in a single pane

Checklist

  • Changes have been checked by the developer
  • Changes have been checked by the reviewers
  • Unit tested
Screenshots or videos:

Source sample app in a 2 pane layout on a tablet. Showing the preview buttons in the left pane and a preview of palette colours in the right pane.

adi-gnm added 6 commits March 13, 2026 20:51
Set Home as list and all other entries as detail.

Removed previous animation - list detail uses its own animation.

Set to single pane on small devices and when only Home is showing.
@adi-gnm adi-gnm added Android Android specific PRs feature Departmental tracking: work on a new feature maintenance Departmental tracking: maintenance work, not a fix or a feature and removed feature Departmental tracking: work on a new feature labels Mar 13, 2026
@adi-gnm adi-gnm marked this pull request as ready for review March 13, 2026 21:11
@adi-gnm adi-gnm requested a review from a team as a code owner March 13, 2026 21:11
Copilot AI review requested due to automatic review settings March 13, 2026 21:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Material 3 adaptive Navigation3 list/detail support to the Android sample app so larger screens can present a 2-pane layout while keeping phones in a single-pane experience.

Changes:

  • Introduces ListDetailSceneStrategy for NavDisplay and annotates nav entries as list vs detail panes.
  • Adds adaptive pane directive logic to switch between 1- and 2-pane layouts based on window size and whether Home is topmost.
  • Adjusts sample UI for the new layout (Home becomes scrollable; removes custom transitions now handled by the scene strategy) and adds the adaptive-navigation3 dependency.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
android/sample/src/main/kotlin/com/gu/source/MainActivity.kt Switches Navigation3 to a list/detail scene strategy with an adaptive directive and pane metadata.
android/sample/src/main/kotlin/com/gu/source/Home.kt Makes the Home content vertically scrollable and updates the title text.
android/sample/src/main/kotlin/com/gu/source/previews/PromoStickerPreview.kt Tweaks promo sticker grid column configuration.
android/sample/build.gradle.kts Adds the adaptive-navigation3 dependency to the sample app.
android/gradle/libs.versions.toml Bumps AndroidX/Compose versions and adds the adaptive-navigation3 catalog entry.
android/sample/detekt-baseline.xml Updates the baseline entry to match the updated onCreate signature/annotation.
.github/dependabot.yml Removes unused dependency patterns from grouping configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android Android specific PRs maintenance Departmental tracking: maintenance work, not a fix or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants