-
Notifications
You must be signed in to change notification settings - Fork 56
Add bottom sheet recipe #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit adds a recipe that demonstrates how to display a navigation destination within a Material `ModalBottomSheet`. It introduces `BottomSheetSceneStrategy`, a `SceneStrategy` that can be added to a `NavDisplay`. This strategy checks for specific metadata on a `NavEntry` to determine if it should be rendered as a bottom sheet. A new `BottomSheetActivity` is added to showcase how to use this strategy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @jbw0033, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a new "recipe" demonstrating how to integrate Material Design ModalBottomSheet components with the Nav3 navigation library. It provides a custom SceneStrategy that allows navigation destinations to be displayed as bottom sheets, enhancing UI flexibility for Android applications.
Highlights
- New BottomSheetSceneStrategy: Introduced BottomSheetSceneStrategy, a custom SceneStrategy for NavDisplay that enables rendering navigation entries as Material ModalBottomSheet components.
- Metadata-driven Bottom Sheet Display: Implemented a metadata-based mechanism (BottomSheetSceneStrategy.bottomSheet()) to designate specific NavEntry instances for display within a bottom sheet.
- New Example Activity: Added BottomSheetActivity as a comprehensive example showcasing the practical application and integration of the new bottom sheet navigation strategy.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new recipe for displaying a navigation destination inside a Material ModalBottomSheet
. The implementation is well-structured, adding a BottomSheetSceneStrategy
and a corresponding BottomSheetActivity
to demonstrate its usage. The code is clear and effectively showcases the feature. I have one minor suggestion to improve adherence to Kotlin's coding conventions.
app/src/main/java/com/example/nav3recipes/bottomsheet/BottomSheetSceneStrategy.kt
Outdated
Show resolved
Hide resolved
What happens if you have a button in the bottomsheet that pop the bottomsheet from the backstack, would that mean no animation? How would you handle that? |
Doing this for Kotlin code syntax
That is something that would be a good feature request to file here for the material team to address. |
But is it even possible with the current implementation of nav3 and the scenes? I can think of some ugly hacks but no clean way with the current implementation, that is why I ask here? Maybe I just missed something but I think this receipt show that too because for me the this receipt would not be final without having that animation because it is a pretty common thing if you for example have some kind of menu in the bottom sheet. Because the material 3 bottom sheet has everything it needs to implement it but I don't think the nav3 lib does but I can of course have missed something 🙂 |
I don't think this is currently possible and have requested this in https://issuetracker.google.com/440558061. The issue is that A possible workaround (which I haven't tried) would be to programmatically trigger a back event, this would be handled by |
I just wrapped the content with this Then you use the function instead of your backstack and voila, animation is working, stack is working. |
This commit adds a recipe that demonstrates how to display a navigation destination within a Material
ModalBottomSheet
.It introduces
BottomSheetSceneStrategy
, aSceneStrategy
that can be added to aNavDisplay
. This strategy checks for specific metadata on aNavEntry
to determine if it should be rendered as a bottom sheet.A new
BottomSheetActivity
is added to showcase how to use this strategy.#32