SlideShare una empresa de Scribd logo
1 de 37
Descargar para leer sin conexión
Compose Navigation
Navigate between screens easily with Jetpack Compose 🚀
22.02.2022
Set-up
Dependencies and additional steps 🚧
Basic navigation
Navigating between screens and passing arguments
Passing complex data
Add your favorite library for serialization
Navigation testing
Add following dependency
Note: If youʼre using Hilt you might need more dependencies, but this wonʼt be covered in this meetup 🙈
Navigation animation
Animating your screen transitions with Accompanist Navigation Animation
Note: Learn more about Navigation Animation: https://google.github.io/accompanist/navigation-animation/
Navigation basics
Creating NavHost and destinations 🚩
Create NavHost
And pass NavController with start destination
Note: To create an instance of NavController, use rememberNavController() function
Start
destination
And your Composable to the NavGraphBuilder
You need to pass the route name - you will use it later to navigate to this screen
Add route
Passing primitive types
Itʼs recommended to pass only essential data 🙌
This is the recommended way 🚨
It doesnʼt break SSOT principle
Note: To learn more, please visit this link Retrieving complex data when navigating
What types can we pass?
We can pass 11 available types without any additional set-up
NavType Type Description
NavType.BoolArrayType NavType<BooleanArray?> NavType for storing boolean arrays, corresponding with the "boolean[]" type in a Navigation XML file.
NavType.BoolType NavType<Boolean> NavType for storing boolean values, corresponding with the "boolean" type in a Navigation XML file.
NavType.FloatArrayType NavType<FloatArray?> NavType for storing float arrays, corresponding with the "float[]" type in a Navigation XML file.
NavType.FloatType NavType<Float> NavType for storing float values, corresponding with the "float" type in a Navigation XML file.
NavType.IntArrayType NavType<IntArray?> NavType for storing integer arrays, corresponding with the "integer[]" type in a Navigation XML file.
NavType.IntType NavType<Int> NavType for storing integer values, corresponding with the "integer" type in a Navigation XML file.
NavType.LongArrayType NavType<LongArray?> NavType for storing long arrays, corresponding with the "long[]" type in a Navigation XML file.
NavType.LongType NavType<Long> NavType for storing long values, corresponding with the "long" type in a Navigation XML file.
NavType.ReferenceType NavType<Int> NavType for storing integer values representing resource ids, corresponding with the "reference" type
in a Navigation XML file.
NavType.StringArrayType NavType<Array<String>?> NavType for storing String arrays, corresponding with the "string[]" type in a Navigation XML file.
NavType.StringType NavType<String?> NavType for storing String values, corresponding with the "string" type in a Navigation XML file.
Create new destination
With out-of-the-box arguments
Note: This is the recommended way to pass data
Add route and
arguments separated
by /
Provide a list of
NamedNavArguments
Passing simple data
Simply using template expression
Note: This is the recommended way to pass data
Getting simple data from NavBackStackEntry
From arguments parameter
Note: This is the recommended way to pass data
Get argument
from
NavBackStackE
ntry
Passing complex data
If you still want to pass your Parcelables 💭
Create custom NavType
By extending NavType
Note: You can use your favorite library for serialization, Kotlin Serialization, Moshi, etc.
Create new destination
With your custom NavType
Note: This goes against the SSOT principle and Google recommendations, as well as adds more complexity to navigation.
Add route and
arguments separated
by /
Provide a list of
NamedNavArguments
Passing complex data
In 3 steps - encode our Parcelable into Json string, encode to UTF-8 scheme and pass to NavController
Note: Since navigation is using NavDeepLinkRequest under the hood, we need to make sure we use Uri.encode(...)
Why do we need Uri.encode(...)?! 😱
If you forget to encode your JSON string, you will get an exception…
Note: Uri.encode(...) encodes characters in the given string as '%'-escaped octets using the UTF-8 scheme. Leaves letters ("A-Z", "a-z"),
numbers ("0-9"), and unreserved characters ("_-!.~'()*") intact. Encodes all other characters.
Get your Parcelable
Similar to primitive types you can get from NavBackStackEntry
Note: This goes against the SSOT principle and Google recommendations, as well as adds more complexity to navigation.
Get Parcelable
Organizing navigation code
No-one likes endless NavHosts 😰
Create extension functions
Declare your composable destination, inject your ViewModels and get arguments in a separate file
Note: This is especially useful when you process multiple arguments 😊
Deeplinks
Set-up deeplinks to your destinations 🌎
Declare intent filter
In your AndroidManifest.xml
Intent filter for your
deeplink
Pass the list of deeplinks
To your composable.
Add a list of NavDeepLinks
Note: Thatʼs it! You donʼt need additional logic to get the argument, it will work exactly the same as regular arguments!
Your deeplinks are ready! 👏
Time to verify if they are working
Testing your navigation
Making sure it works correctly 👋
Set-up your test
Under androidTest directory (e.g. NavigationTest.kt)
Perform some actions with ComposeTestRule
And assert NavBackStackEntry destination
Animate screen transitions
Adding extra touch to your navigation in 4 steps 🎶
Step 1. Replace your NavController
To AnimatedNavController
Replace
with
Step 2. Replace NavHost
With AnimatedNavHost
Replace
with
Step 3. Replace composable import
To the one provided by Accompanist library
Replace
with
Note: If you forget this, you will not see any screen in your navigation 😐
Step 4 (Option 1). Add transitions to all NavHost
The solution below will add default transitions for all destinations
Step 4 (Option 2). Add transitions to composables
If you need different transitions for your destinations, you can pass them to composable(...) function
UPCOMING MEETUP
Check out our event page
Stay tuned for whatʼs coming next!

Más contenido relacionado

La actualidad más candente

State management
State managementState management
State management
Iblesoft
 

La actualidad más candente (20)

Spring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em JavaSpring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em Java
 
NestJS
NestJSNestJS
NestJS
 
In-Depth Model/View with QML
In-Depth Model/View with QMLIn-Depth Model/View with QML
In-Depth Model/View with QML
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
 
Angular Advanced Routing
Angular Advanced RoutingAngular Advanced Routing
Angular Advanced Routing
 
Jetpack Compose.pptx
Jetpack Compose.pptxJetpack Compose.pptx
Jetpack Compose.pptx
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
State management
State managementState management
State management
 
Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Practical non blocking microservices in java 8
Practical non blocking microservices in java 8
 
ListView RecyclerView.pptx
ListView RecyclerView.pptxListView RecyclerView.pptx
ListView RecyclerView.pptx
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
 
Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018
 
Jetpack Navigation Component
Jetpack Navigation ComponentJetpack Navigation Component
Jetpack Navigation Component
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 
Utilizing kotlin flows in an android application
Utilizing kotlin flows in an android applicationUtilizing kotlin flows in an android application
Utilizing kotlin flows in an android application
 
Spring Data Jpa
Spring Data JpaSpring Data Jpa
Spring Data Jpa
 
Angular routing
Angular routingAngular routing
Angular routing
 
In-depth analysis of Kotlin Flows
In-depth analysis of Kotlin FlowsIn-depth analysis of Kotlin Flows
In-depth analysis of Kotlin Flows
 
Jetpack Compose a new way to implement UI on Android
Jetpack Compose a new way to implement UI on AndroidJetpack Compose a new way to implement UI on Android
Jetpack Compose a new way to implement UI on Android
 

Similar a Seven Peaks Speaks - Compose Navigation

Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labsApache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
Viswanath Gangavaram
 
Linq To The Enterprise
Linq To The EnterpriseLinq To The Enterprise
Linq To The Enterprise
Daniel Egan
 
Node js
Node jsNode js
Node js
hazzaz
 

Similar a Seven Peaks Speaks - Compose Navigation (20)

Unit 3
Unit 3Unit 3
Unit 3
 
Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...
 
js.pptx
js.pptxjs.pptx
js.pptx
 
Spray - Build RESTfull services in scala
Spray - Build RESTfull services in scalaSpray - Build RESTfull services in scala
Spray - Build RESTfull services in scala
 
Spray
SpraySpray
Spray
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Express node js
Express node jsExpress node js
Express node js
 
Umbraco OktoberFest 2014
Umbraco OktoberFest 2014Umbraco OktoberFest 2014
Umbraco OktoberFest 2014
 
Spark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross LawleySpark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross Lawley
 
How To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own DatasourceHow To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own Datasource
 
Language-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible researchLanguage-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible research
 
Scala at Netflix
Scala at NetflixScala at Netflix
Scala at Netflix
 
Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labsApache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
Apache pig power_tools_by_viswanath_gangavaram_r&d_dsg_i_labs
 
iOS best practices
iOS best practicesiOS best practices
iOS best practices
 
Big Data, Data Lake, Fast Data - Dataserialiation-Formats
Big Data, Data Lake, Fast Data - Dataserialiation-FormatsBig Data, Data Lake, Fast Data - Dataserialiation-Formats
Big Data, Data Lake, Fast Data - Dataserialiation-Formats
 
Python
PythonPython
Python
 
Linq To The Enterprise
Linq To The EnterpriseLinq To The Enterprise
Linq To The Enterprise
 
MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011
 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
 
Node js
Node jsNode js
Node js
 

Más de Seven Peaks Speaks

BKK Web: Working with SEO
BKK Web: Working with SEOBKK Web: Working with SEO
BKK Web: Working with SEO
Seven Peaks Speaks
 

Más de Seven Peaks Speaks (20)

BKK Web: Working with SEO
BKK Web: Working with SEOBKK Web: Working with SEO
BKK Web: Working with SEO
 
Seven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose AnimationSeven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose Animation
 
How to Get Better Performance Out of Your App
How to Get Better Performance Out of Your AppHow to Get Better Performance Out of Your App
How to Get Better Performance Out of Your App
 
RxSubject And Operators
RxSubject And OperatorsRxSubject And Operators
RxSubject And Operators
 
Concurrency in Swift
Concurrency in SwiftConcurrency in Swift
Concurrency in Swift
 
DevSecOps on Azure
DevSecOps on AzureDevSecOps on Azure
DevSecOps on Azure
 
Secure Development of Azure Function
Secure Development of Azure FunctionSecure Development of Azure Function
Secure Development of Azure Function
 
Develop Security & Compliances in Azure
Develop Security & Compliances in AzureDevelop Security & Compliances in Azure
Develop Security & Compliances in Azure
 
Effective Lists Management
Effective Lists ManagementEffective Lists Management
Effective Lists Management
 
Layout Preview Tooling
Layout Preview ToolingLayout Preview Tooling
Layout Preview Tooling
 
Background Processing With Work Manager
Background Processing With Work ManagerBackground Processing With Work Manager
Background Processing With Work Manager
 
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
 
Structuring node.js projects - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Structuring node.js projects - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Structuring node.js projects - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Structuring node.js projects - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
 
Delivering react app with confidence: Testing Pyramid
Delivering react app with confidence: Testing PyramidDelivering react app with confidence: Testing Pyramid
Delivering react app with confidence: Testing Pyramid
 
React context
React context  React context
React context
 
Getting hooked on performance and clean code
Getting hooked on performance and clean codeGetting hooked on performance and clean code
Getting hooked on performance and clean code
 
Establishing secure Biometric authentication in Android
Establishing secure Biometric authentication in AndroidEstablishing secure Biometric authentication in Android
Establishing secure Biometric authentication in Android
 
Continuously deploy a containerized app to “Azure App Service”
Continuously deploy a containerized app to “Azure App Service”Continuously deploy a containerized app to “Azure App Service”
Continuously deploy a containerized app to “Azure App Service”
 
Static web apps by GitHub action
Static web apps by GitHub actionStatic web apps by GitHub action
Static web apps by GitHub action
 
Developers Guide to Cosmos DB
Developers Guide to Cosmos DBDevelopers Guide to Cosmos DB
Developers Guide to Cosmos DB
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Seven Peaks Speaks - Compose Navigation

  • 1. Compose Navigation Navigate between screens easily with Jetpack Compose 🚀 22.02.2022
  • 3. Basic navigation Navigating between screens and passing arguments
  • 4. Passing complex data Add your favorite library for serialization
  • 5. Navigation testing Add following dependency Note: If youʼre using Hilt you might need more dependencies, but this wonʼt be covered in this meetup 🙈
  • 6. Navigation animation Animating your screen transitions with Accompanist Navigation Animation Note: Learn more about Navigation Animation: https://google.github.io/accompanist/navigation-animation/
  • 7. Navigation basics Creating NavHost and destinations 🚩
  • 8. Create NavHost And pass NavController with start destination Note: To create an instance of NavController, use rememberNavController() function Start destination
  • 9. And your Composable to the NavGraphBuilder You need to pass the route name - you will use it later to navigate to this screen Add route
  • 10. Passing primitive types Itʼs recommended to pass only essential data 🙌
  • 11. This is the recommended way 🚨 It doesnʼt break SSOT principle Note: To learn more, please visit this link Retrieving complex data when navigating
  • 12. What types can we pass? We can pass 11 available types without any additional set-up NavType Type Description NavType.BoolArrayType NavType<BooleanArray?> NavType for storing boolean arrays, corresponding with the "boolean[]" type in a Navigation XML file. NavType.BoolType NavType<Boolean> NavType for storing boolean values, corresponding with the "boolean" type in a Navigation XML file. NavType.FloatArrayType NavType<FloatArray?> NavType for storing float arrays, corresponding with the "float[]" type in a Navigation XML file. NavType.FloatType NavType<Float> NavType for storing float values, corresponding with the "float" type in a Navigation XML file. NavType.IntArrayType NavType<IntArray?> NavType for storing integer arrays, corresponding with the "integer[]" type in a Navigation XML file. NavType.IntType NavType<Int> NavType for storing integer values, corresponding with the "integer" type in a Navigation XML file. NavType.LongArrayType NavType<LongArray?> NavType for storing long arrays, corresponding with the "long[]" type in a Navigation XML file. NavType.LongType NavType<Long> NavType for storing long values, corresponding with the "long" type in a Navigation XML file. NavType.ReferenceType NavType<Int> NavType for storing integer values representing resource ids, corresponding with the "reference" type in a Navigation XML file. NavType.StringArrayType NavType<Array<String>?> NavType for storing String arrays, corresponding with the "string[]" type in a Navigation XML file. NavType.StringType NavType<String?> NavType for storing String values, corresponding with the "string" type in a Navigation XML file.
  • 13. Create new destination With out-of-the-box arguments Note: This is the recommended way to pass data Add route and arguments separated by / Provide a list of NamedNavArguments
  • 14. Passing simple data Simply using template expression Note: This is the recommended way to pass data
  • 15. Getting simple data from NavBackStackEntry From arguments parameter Note: This is the recommended way to pass data Get argument from NavBackStackE ntry
  • 16. Passing complex data If you still want to pass your Parcelables 💭
  • 17. Create custom NavType By extending NavType Note: You can use your favorite library for serialization, Kotlin Serialization, Moshi, etc.
  • 18. Create new destination With your custom NavType Note: This goes against the SSOT principle and Google recommendations, as well as adds more complexity to navigation. Add route and arguments separated by / Provide a list of NamedNavArguments
  • 19. Passing complex data In 3 steps - encode our Parcelable into Json string, encode to UTF-8 scheme and pass to NavController Note: Since navigation is using NavDeepLinkRequest under the hood, we need to make sure we use Uri.encode(...)
  • 20. Why do we need Uri.encode(...)?! 😱 If you forget to encode your JSON string, you will get an exception… Note: Uri.encode(...) encodes characters in the given string as '%'-escaped octets using the UTF-8 scheme. Leaves letters ("A-Z", "a-z"), numbers ("0-9"), and unreserved characters ("_-!.~'()*") intact. Encodes all other characters.
  • 21. Get your Parcelable Similar to primitive types you can get from NavBackStackEntry Note: This goes against the SSOT principle and Google recommendations, as well as adds more complexity to navigation. Get Parcelable
  • 22. Organizing navigation code No-one likes endless NavHosts 😰
  • 23. Create extension functions Declare your composable destination, inject your ViewModels and get arguments in a separate file Note: This is especially useful when you process multiple arguments 😊
  • 24. Deeplinks Set-up deeplinks to your destinations 🌎
  • 25. Declare intent filter In your AndroidManifest.xml Intent filter for your deeplink
  • 26. Pass the list of deeplinks To your composable. Add a list of NavDeepLinks Note: Thatʼs it! You donʼt need additional logic to get the argument, it will work exactly the same as regular arguments!
  • 27. Your deeplinks are ready! 👏 Time to verify if they are working
  • 28. Testing your navigation Making sure it works correctly 👋
  • 29. Set-up your test Under androidTest directory (e.g. NavigationTest.kt)
  • 30. Perform some actions with ComposeTestRule And assert NavBackStackEntry destination
  • 31. Animate screen transitions Adding extra touch to your navigation in 4 steps 🎶
  • 32. Step 1. Replace your NavController To AnimatedNavController Replace with
  • 33. Step 2. Replace NavHost With AnimatedNavHost Replace with
  • 34. Step 3. Replace composable import To the one provided by Accompanist library Replace with Note: If you forget this, you will not see any screen in your navigation 😐
  • 35. Step 4 (Option 1). Add transitions to all NavHost The solution below will add default transitions for all destinations
  • 36. Step 4 (Option 2). Add transitions to composables If you need different transitions for your destinations, you can pass them to composable(...) function
  • 37. UPCOMING MEETUP Check out our event page Stay tuned for whatʼs coming next!