-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Navigation] Introduce navigation-compose-material and support for bottom sheet navigation destinations #173
[Navigation] Introduce navigation-compose-material and support for bottom sheet navigation destinations #173
Conversation
49579a4
to
09c9d7e
Compare
09c9d7e
to
5a06c36
Compare
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.
Just a high level review at the moment - I hope to have some time to dive into the details in a later review (one CL huh? lol).
It looks like there's a few more infrastructural things (like the SaveableStateProvider
) that we should split off into separate PRs that can be merged in prior to this. Let me know if you'd like to do this or if you'd like us to do this ahead of time.
I have some ideas on how we'd like to approach each of these if you'd like to reach out to me or just list out what dependencies you need here and I can comment on each.
...-compose-material/src/main/java/androidx/navigation/compose/material/BottomSheetNavigator.kt
Outdated
Show resolved
Hide resolved
...igation-demos/src/main/java/androidx/navigation/compose/material/demos/BottomSheetNavDemo.kt
Show resolved
Hide resolved
...igation-demos/src/main/java/androidx/navigation/compose/material/demos/BottomSheetNavDemo.kt
Outdated
Show resolved
Hide resolved
...e-material/src/androidTest/java/androidx/navigation/compose/material/SheetContentHostTest.kt
Show resolved
Hide resolved
...-compose-material/src/main/java/androidx/navigation/compose/material/BottomSheetNavigator.kt
Show resolved
Hide resolved
c9fd9dc
to
33a13f4
Compare
4267618
to
d0e4a20
Compare
...igation-demos/src/main/java/androidx/navigation/compose/material/demos/BottomSheetNavDemo.kt
Outdated
Show resolved
Hide resolved
...-compose-material/src/main/java/androidx/navigation/compose/material/BottomSheetNavigator.kt
Outdated
Show resolved
Hide resolved
...igation-demos/src/main/java/androidx/navigation/compose/material/demos/BottomSheetNavDemo.kt
Outdated
Show resolved
Hide resolved
d67415c
to
08f6fc5
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
a0022cb
to
1e07c7a
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
48a8a30
to
a33a4b3
Compare
...-compose-material/src/main/java/androidx/navigation/compose/material/BottomSheetNavigator.kt
Show resolved
Hide resolved
...-compose-material/src/main/java/androidx/navigation/compose/material/BottomSheetNavigator.kt
Show resolved
Hide resolved
...tion-compose-material/src/main/java/androidx/navigation/compose/material/SheetContentHost.kt
Outdated
Show resolved
Hide resolved
...igation-demos/src/main/java/androidx/navigation/compose/material/demos/BottomSheetNavDemo.kt
Outdated
Show resolved
Hide resolved
...-compose-material/src/main/java/androidx/navigation/compose/material/BottomSheetNavigator.kt
Outdated
Show resolved
Hide resolved
92e3c0f
to
d0a03a0
Compare
Change-Id: I0f7e9f1d4d72c824977052d465cf45004a26cec9
…cause of crash Change-Id: I96cc1cf2eed55c5194905c41d2278de40fcaed4b
Change-Id: I149c313a44df7917e648548f01b2a09bf498281d
…select properties through BottomSheetNavigatorState Change-Id: Icdf496e0b68256034b25781f9d3254142807a686
Change-Id: I5ab782fa46d0b02b55c82e69e5098c0ac25428be
Change-Id: I945813b06cb945533fc0699bb5b54732da16e5e0
Change-Id: Ic7f6020509378d729d9e906235c2cba5d6c7da0f
Change-Id: I6017c5bfbbd438f92fc9ad36a3c09de1f5768ad5
Change-Id: I1eb083a3c5b81485bdb1c33d2c8c6a07dbce82b0
In this test, we were composing (and thus trying to access the BottomSheetNavigator's state) before we had attached the state to the navigator Change-Id: I63309dd8b299ffafaa571226b091eb62ba1f3584
Change-Id: If594ba4d1d5c884bbf8ef9f723e4a00c28e0ae62
Change-Id: I838fd686b37624f6f2e9da9b7da15fdec9b3f6ca
Change-Id: I1f03e990370dc421cca089f65d24399446979eb3
Change-Id: I4ae5d166118c55ec34d9a635660521d10b9afdc8
793c180
to
f3423e1
Compare
Ayyyy whohoo! Thank you so much for sticking with this PR :) Gonna move over to Accompanist! (btw, checks are failing because of Metalava. Hope it'll just magically work over there :D) |
* Introduce Navigation-Compose-Material Module * Import code from androidx/androidx#173 * Use try-finally to set `hideCalled` flag * Run spotless * Introduce ExperimentalMaterialNavigationApi.kt * Update docs and sample * Remove unused import * Update API after introducing ExperimentalNavigationMaterialApi * Update tests to opt-in to experimental APIs * Add dummy tests to help with sharding * Format dummy tests :)
Proposed Changes
For easier integration with
compose-material
'sModalBottomSheetLayout
, this library provides convenience wrappers and aBottomSheetNavigator
to be able to declare and navigate to bottom sheet destinations, similar to bottom sheet dialog destinations in vanilla navigation.BottomSheetNavigator
drives aModalBottomSheetLayout
'ssheetContent
and state, controlling visibility according to the back stack and composing and disposing destinations that are navigated to or away from.BottomSheetNavigator
offers thesheetContent
as a composable that should be set as theModalBottomSheetLayout
'ssheetContent
.NavGraphBuilder#bottomSheet
NavController
'snavigatorProvider
ModalBottomSheetLayout
that accepts aBottomSheetNavigator
BackStackEntryIdViewModel
and theSaveableStateHolder.SaveableStateProvider
extension into their own file innavigation-compose
because they are needed innavigation-compose-material
Generating the API files foras a workaround I addednavigation-compose-material
makes lint trip up about overloads/Java compatibility on a composable function (src/main/java/androidx/navigation/compose/material/BottomSheet.kt:35: error: A Kotlin method with default parameter values should be annotated with @JvmOverloads for better Java interoperability
), so any pointers there would be appreciated :)navigation-compose-material
to the list of exceptions inAndroidXExtension#targetsJavaConsumers
locally to generate the API files. That might even be the correct solution, let me know what you think is best.I also thought about making
navigation-compose-material
a submodule ofnavigation-compose
- would that be better?Please let me know if you have ideas for more tests, I plan on adding a couple more, not super happy with them yet.
Cheers!
Testing
Test: Added tests for new behavior (
BottomSheetNavigatorTest
,SheetContentHostTest
,NavGraphBuilderTest
), ran with./gradlew test connectedCheck
. More tests to be added.Demos: Introduced BottomSheetNavDemo
Issues Fixed
Fixes: b/180247978