Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elton2048/simplestacktest
Example using simple-stack to show how to use multiple stacks in both activity/fragment.
https://github.com/elton2048/simplestacktest
android anko backstack navigation
Last synced: 16 days ago
JSON representation
Example using simple-stack to show how to use multiple stacks in both activity/fragment.
- Host: GitHub
- URL: https://github.com/elton2048/simplestacktest
- Owner: elton2048
- Created: 2018-04-18T07:45:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T09:39:10.000Z (over 6 years ago)
- Last Synced: 2024-10-24T15:32:09.160Z (about 2 months ago)
- Topics: android, anko, backstack, navigation
- Language: Kotlin
- Homepage:
- Size: 692 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Stack example for multiple stacks in activity/fragment
Based on [simple-stack](https://github.com/Zhuinden/simple-stack/) library
This example shows how to have multiple stacks to represent application state in both activity and fragment using fragment approach.
This shows one way how to separate fragments on different scope using different stacks based on [simple-stack](https://github.com/Zhuinden/simple-stack/) library. If there is any better way feel free to comment.
There is also parts to demonstrate how Anko can be used in
to create UI for the layout and create custom layout which customization can be made* Create UI for the layout in view/fragment/activity...
* Create custom layout which customization can be made using method for some preset behaviour.## What this example serves for?
Why using multiple stacks to represent application state? There is one common scenario to show the use case.
Imagine your application has one full page view with a button at the beginning. When you click the button it turns to a page with different tabs using BottomNavigationView. You can switch different tabs without stacking the history. History will be stored in individual stacks.
The gif shows what the project serves.
## Anko layout
See DashboardBlock for detail how UI is created and used in fragment.
For custom layout, [BlockLayout](https://github.com/elton2048/SimpleStackTest/tree/master/feature/src/main/java/elton/com/simplestacktest/utils/ankolayout/BlockLayout.kt) and [TitleBar](https://github.com/elton2048/SimpleStackTest/tree/master/feature/src/main/java/elton/com/simplestacktest/utils/ankolayout/TitleBar.kt) are the example how it can be done and how the preset behaviour set.