Sign in Go Pro

Course

Dependency Injection with Dagger 2

55 lessons

02:19:45 total

Illustration

About

In this course, you’ll learn about dependency injection with Dagger 2, including diving into the generated code to understand how Dagger works under the hood.

We’re going to build an app from the ground up, but we’ll focus mostly on how Dagger works, rather than “this is the exact architecture you should use in your app”. Different architectures fit different needs and styles, and Dagger can be a huge boon to anyone of them. Once the Dagger magic is gone, it’s much easier to make it work for you, in your own way. That’s the goal of this course.

Topics include:

  • Components/Modules
  • Scopes
  • Qualifiers
  • Multibindings
  • Component lifecycle management
  • Swapping injected dependencies in Espresso tests
  • Generated code exploration

When you’re done with this course, you should feel comfortable knowing where to look to figure out how Dagger is connecting your dependencies with the objects that need them. With this knowledge, you’ll be in a better spot to design your own Dagger-driven architecture.

Instructors

Lessons in this course

1. Intro to Dependency Injection - Simple example with no DI
01:47
Brandon Gogetap
2. Intro to Dependency Injection - Dependency Injection in Practice
00:35
Brandon Gogetap
3. Why we use Dependency Injection
01:59
Brandon Gogetap
4. How Dependency Injection frameworks help
00:37
Brandon Gogetap
5. What we're building - Final Product
01:04
Brandon Gogetap
6. Creating the GitHub Browser Project
01:45
Brandon Gogetap
7. Creating the Application Component Interface
01:10
Brandon Gogetap
8. Building the Application Component
01:02
Brandon Gogetap
9. Dagger codegen: Inspecting the generated Application Component
00:47
Brandon Gogetap
10. Adding the GitHubApi Module
02:01
Brandon Gogetap
11. Creating a Dagger 2 Module
02:36
Brandon Gogetap
12. Creating the AppRepository - The single source of data for the UI
Pro
02:47
Brandon Gogetap
13. Dagger codegen: Checking in on the generated Application Component
Pro
02:41
Brandon Gogetap
14. Unit Testing the AppRepository
Pro
03:07
Brandon Gogetap
15. Feature: Home Screen
Pro
01:55
Brandon Gogetap
16. Home Screen Repository List Setup
Pro
04:40
Brandon Gogetap
17. Home Screen ViewModel
Pro
04:34
Brandon Gogetap
18. Injecting a Jetpack ViewModel
Pro
03:14
Brandon Gogetap
19. Exposing Singleton Dependencies in a Modular Way
Pro
02:34
Brandon Gogetap
20. Home Screen Component
Pro
04:01
Brandon Gogetap
21. Dagger codegen: Component Dependencies
Pro
03:16
Brandon Gogetap
22. Dagger codegen: Multibindings
Pro
02:31
Brandon Gogetap
23. Dagger codegen: @Binds, @Provides, and Modules
Pro
03:03
Brandon Gogetap
24. Matching Dagger Component Scopes with ViewModel Scopes
Pro
04:07
Brandon Gogetap
25. Unit Testing HomeViewModel
Pro
04:14
Brandon Gogetap
26. Displaying fake data in the Home Fragment
Pro
03:39
Brandon Gogetap
27. Espresso tests and Dagger: Modularizing ApplicationComponent
Pro
02:39
Brandon Gogetap
28. Espresso tests and Dagger: Adding the TestApplicationComponent
Pro
04:42
Brandon Gogetap
29. Espresso tests and Dagger: Adding the Test Application and Runner
Pro
01:49
Brandon Gogetap
30. HomeFragment Espresso Test
Pro
03:56
Brandon Gogetap
31. Retrofit integration: Suspend Functions
Pro
03:49
Brandon Gogetap
32. Retrofit integration: Preparing for the real GitHub API
Pro
04:00
Brandon Gogetap
33. Retrofit integration: Swapping mock GitHubApi with implementation created by Retrofit
Pro
04:11
Brandon Gogetap
34. Dagger Modules: Build variants/flavors
Pro
01:46
Brandon Gogetap
35. Dagger codgen: Effects of Module changes
Pro
02:19
Brandon Gogetap
36. Feature: Repo Details Screen
Pro
01:20
Brandon Gogetap
37. Repo Details Component
Pro
01:55
Brandon Gogetap
38. RepoDetails ViewModel Part 1
Pro
01:40
Brandon Gogetap
39. Dagger codegen: Qualifier Annotations
Pro
01:30
Brandon Gogetap
40. Extending GitHub API: Single repository fetch
Pro
01:31
Brandon Gogetap
41. AppRepository updates: Caching and new request
Pro
01:19
Brandon Gogetap
42. AppRepository Unit Test Updates
Pro
02:05
Brandon Gogetap
43. Repo Details Contributors List Setup
Pro
01:29
Brandon Gogetap
44. Repo Details View States
Pro
02:12
Brandon Gogetap
45. Repo Details ViewModel Test
Pro
01:35
Brandon Gogetap
46. Hooking up RepoDetailsFragment with View States
Pro
01:43
Brandon Gogetap
47. RepoDetailsFragment Espresso Test
Pro
02:34
Brandon Gogetap
48. Preparing for screen navigation
Pro
04:08
Brandon Gogetap
49. Activity Scoped Component
Pro
01:43
Brandon Gogetap
50. Activity Screen Navigator
Pro
02:04
Brandon Gogetap
51. Fake ScreenNavigator: A fake navigator for tests
Pro
01:12
Brandon Gogetap
52. Navigating from the Home screen to the Details screen
Pro
03:36
Brandon Gogetap
53. Dagger codegen: Walking through all the layers
Pro
06:03
Brandon Gogetap
54. PowerAdapter - A Dependency Injection driven RecyclerView Adapter
Pro
01:32
Brandon Gogetap
55. Using PowerAdapter for the Home screen
Pro
03:37
Brandon Gogetap