surface-duo-compose-samples/NavigationRail
Joy Liu a49a3fc471
Introduce DragAndDrop sample (#88)
* Create DragAndDrop sample

* Add DragTarget and DropTarget

* Building UI

* Update DragContainer and DropContainer

* Implement text drag and drop

* Introduce DragData and MimiType

* Update system bar color

* Fix the draggable size

* Build UI in the single-pane mode

* Add floating button to reset the UI

* Add highlight interaction when dragging

* Update dependencies

* Add UI test case

* Address comments

* Re-introduce the project

* Update README

* Code clean-up

* Update screenshot to gif

* Update app icon

* Remove DS_Store and log
2022-06-21 18:02:59 -07:00
..
screenshots Move TwoPaneLayout to separate repo (#68) 2021-11-11 09:04:20 -05:00
src Update samples to new TwoPaneLayout version (#89) 2022-06-09 11:31:39 -07:00
.gitignore Move TwoPaneLayout to separate repo (#68) 2021-11-11 09:04:20 -05:00
README.md Move TwoPaneLayout to separate repo (#68) 2021-11-11 09:04:20 -05:00
build.gradle Introduce DragAndDrop sample (#88) 2022-06-21 18:02:59 -07:00

README.md

Navigation Rail

This sample is built with Jetpack Compose, the new UI framework in Android.

Getting Started

To learn how to load apps on the Surface Duo emulator, see the documentation, and follow the blog.

Features

The sample showcases how to incorporate the NavigationRail component into a Jetpack Compose application for large screen and foldable devices.

Dynamic navigation components

When the app is spanned and the screen size is larger, it uses a NavigationRail.

Lakes gallery dual portrait Animals gallery dual landscape

When the app is unspanned, however, it switches back to a BottomNavigation bar.

Birds gallery single portrait Rocks gallery single landscape

Hinge-aware content drawer

The app features a custom content drawer component, similar to BottomSheetScaffold, that adds a Spacer to the drawer content if it's being rendered across the hinge.

Demo of content drawer

Navigation hierarchy

The app uses two sources of navigation.

To switch between gallery and item views, we use the built in navigation support from TwoPaneLayout.

TwoPaneLayout navigation logic

To switch between the gallery categories, we use a NavHostController and NavHostparied with the current navigation component.

NavHost navigation logic

Attributions

The images used in the NavigationRail sample are licensed under [© eakarat], [© nerudol], [© DedMityay], [© tibor13], [© Harry Collins], [© Tony Baggett], [© WildMedia], [© Vlasto Opatovsky], [© Lakeview Images], [© viktoriya89], [© dudlajzov], [© zkbld], [© muraviov], [© phototrip.cz], [© gpisano71], [© Mike Mareen], [ © Fokke], [© ronnybas], [© Piotr Krzeslak], [© shaiith], [© aiisha], [© Andrew Mayovskyy], [© Andrey Armyagov], [© Наталья Босяк] / stock.adobe.com

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

Copyright (c) Microsoft Corporation.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.