Posted by Murat Yener
It’s a wrap!! We’ve just finished the second series of Navigation on MAD Skills. In this series, we re-visited Chet’s DonutTracker app and added an important missing feature: the ability to track coffee.
With new functionality comes new responsibilities. While we added coffee tracking, we also improved the navigation experience, implemented conditional navigation, modularized the app and finally learned what is changing with multiple back stack support.
Episode 1: NavigationUI
As new destinations were added to the app,we used NavigationUI to offer a better navigation UI experience. NavigationUI helped us automatically integrate NavigationView and BottomNavigationView with the existing menu ids for destinations. You can check out the video linked below or if you prefer read the article here.
Episode 2: Conditional Navigation
We added coffee tracking functionality in the first episode but no matter whether users disable or enable the coffee tracker, they could still navigate to the CoffeeList fragment. In this episode, we fixed that by adding conditional navigation and directing our users to make a selection when they launch the app for the first time.
You can find the same content in article form here.
Episode 3: Nested Graphs and Include
In the third episode, we took a step back and organized the navigation graph by using nested graphs and using the include tag to import other graphs. While keeping our project more organized, this also allowed us to modularize the app and see how navigation works with modules. Check out the article or the video below.
Episode 4: Feature Modules
In the fourth episode, we took the app a step further and converted the coffee module to a feature module. With this change, the coffee tracking feature will only be downloaded and installed for users who enabled this feature. Dynamic features allowed us to modularize the app to save network and storage for the user. To learn more, check out the video linked below or if you prefer read the article here.
Episode 5: Multiple Back Stacks
In this episode, we covered a highly requested feature, multiple back stack support for Navigation. To support multiple back stacks, all you need to do is to update your navigation and fragment dependencies. You can observe multiple back stack behavior with NavigationView and BottomNavigationView instantly without any code change!
You can also find the same content in article form here.
Episode 6: Live Q&A
Finally, we wrapped up the second series of Navigation with a live Q&A session where we answered your questions. If you missed the Q&A, make sure to check out the recording below.
Donut and Coffee Tracker
The application used for the first 4 episodes in the series is the DonutTracker app which Chet built during the first Navigation series on MAD Skills. You can follow the progress in each episode by checking out the starter and solution code from this repo.
Navigation Advanced Sample
This project is used to demonstrate Multiple back stack support in Navigation. Before Navigation version 2.4.0-alpha01, this project offered NavigationExtensions to mimic the multiple back stack behavior. You can check out the solution code with updated dependencies and NavigationExtensions removed in this repo.
This brings an end to the second Navigation series but the MAD series will continue with another exciting topic! Make sure you stay tuned for more Android MADness!
Source: Android Developers Blog