Support 2-pane list detail layout for sample app on larger screens#344
Open
Support 2-pane list detail layout for sample app on larger screens#344
Conversation
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.
Contributor
There was a problem hiding this comment.
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
ListDetailSceneStrategyforNavDisplayand 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.
android/sample/src/main/kotlin/com/gu/source/previews/PromoStickerPreview.kt
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Description
Add support for larger screens in sample app.
Uses the
ListDetailSceneStrategyfrom Material 3 adaptive for 2 pane support. All key changes are inMainActivity.ListDetailSceneStrategytoNavDisplayListDetailSceneStrategyalready includes the same horizontal slide transitionsTesting notes/instructions:
Use a foldable, tablet or landscape phone to test.
Checklist
Screenshots or videos: