codeslubber
05/19/2017, 3:52 PMmaciekjanusz
05/19/2017, 3:57 PMmaciekjanusz
05/19/2017, 3:58 PMcodeslubber
05/19/2017, 3:59 PMmaciekjanusz
05/19/2017, 4:01 PMmaciekjanusz
05/19/2017, 4:01 PMmaciekjanusz
05/19/2017, 4:02 PMmaciekjanusz
05/19/2017, 4:03 PM@ActivityScope
annotation will just enable the annotation processor to make sure the setup is correctmaciekjanusz
05/19/2017, 4:03 PMmaciekjanusz
05/19/2017, 4:04 PMmaciekjanusz
05/19/2017, 4:04 PMcodeslubber
05/19/2017, 4:11 PMcodeslubber
05/19/2017, 4:11 PMmaciekjanusz
05/19/2017, 4:11 PMcodeslubber
05/19/2017, 4:11 PMcodeslubber
05/19/2017, 4:12 PMcodeslubber
05/19/2017, 4:12 PMmaciekjanusz
05/19/2017, 4:12 PMmaciekjanusz
05/19/2017, 4:12 PMmaciekjanusz
05/19/2017, 4:12 PMmaciekjanusz
05/19/2017, 4:13 PMmaciekjanusz
05/19/2017, 4:15 PMmaciekjanusz
05/19/2017, 4:16 PMGithubClientApplication.get(this)
obtains the Application
class object which is an 'entry point' for android apps (this object lives as long as the app process)maciekjanusz
05/19/2017, 4:17 PM.getAppComponent()
obtains the application component, which has the @Singleton
scopemaciekjanusz
05/19/2017, 4:18 PM.plus(new SplashActivityModule(this))
creates a new ActivityComponent
which is a subcomponent of AppComponent
with added SplashActivityModule
maciekjanusz
05/19/2017, 4:18 PMmaciekjanusz
05/19/2017, 4:19 PM.inject(this);
happens, which injects the activity object with dependencies from the ActivityComponent
and AppComponent
as wellmaciekjanusz
05/19/2017, 4:20 PMAppComponent
will be shared, because there is only one AppComponent
, and the ActivityComponent
dependencies will not, as these are created separately for each activitycodeslubber
05/19/2017, 4:23 PMmaciekjanusz
05/19/2017, 4:23 PM@Provides
method will determine if the component instance will create a new instance of a dependency each time it's needed, or whether it will be a singleton in this component scope.christiangruber
05/20/2017, 12:43 AMchristiangruber
05/20/2017, 12:43 AMchristiangruber
05/20/2017, 12:45 AM@Scope
annotations attached to a component form a constraint meaning "the only things that can be memoized in this component are ones so annotated". Then you add the same scope to your @Provides and @Inject-able types which declares your intention for those classes. This lets the Dagger processor complain if you mixed up your modules.codeslubber
05/20/2017, 1:47 AM