You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
Add separate branch implementing optional step from codelab:
[Optional] Try Dependency Injection on your own
There's one more part of the codelab app for you to experiment with, and that's refactoring to have a SplashScreen: MainActivity.kt handles the logic of what screen needs to be shown when opening the app. That's problematic because we're doing conditional dependency injection, only injecting when the user will remain on the MainActivity.
These steps don't contain comments or code, so try it on your own:
Create a SplashActivity with a SplashViewModel that handles the logic of what screen to display.
As we've been doing, use dependency injection in SplashActivity to get fields injected by Dagger.
Remove the logic in the onCreate method of the MainActivity.kt since when the Activity is opened, the user will be logged in.
Add separate branch implementing optional step from codelab:
There's one more part of the codelab app for you to experiment with, and that's refactoring to have a SplashScreen: MainActivity.kt handles the logic of what screen needs to be shown when opening the app. That's problematic because we're doing conditional dependency injection, only injecting when the user will remain on the MainActivity.
These steps don't contain comments or code, so try it on your own:
Create a SplashActivity with a SplashViewModel that handles the logic of what screen to display.
As we've been doing, use dependency injection in SplashActivity to get fields injected by Dagger.
Remove the logic in the onCreate method of the MainActivity.kt since when the Activity is opened, the user will be logged in.