Last active
March 9, 2019 16:22
-
-
Save lisamariewatkins/1af33040aee8791948c5c7b5970f099b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Singleton | |
| @Component(modules = [ | |
| AndroidInjectionModule::class, | |
| ApplicationModule::class, | |
| ActivityModule::class] | |
| ) | |
| interface ApplicationComponent { | |
| @Component.Builder | |
| interface Builder { | |
| @BindsInstance | |
| fun application(application: Application): Builder | |
| fun build(): ApplicationComponent | |
| } | |
| fun inject(app: BaseApplication) | |
| } | |
| @Module | |
| class ApplicationModule { | |
| @Provides | |
| @Singleton | |
| fun providesPetManager(): PetManager { | |
| return PetManagerImpl() | |
| } | |
| } | |
| @Module | |
| abstract class ActivityModule { | |
| @ContributesAndroidInjector(modules = [FragmentBuildersModule::class]) | |
| abstract fun contributesMainActivity(): MainActivity | |
| } | |
| @Module | |
| abstract class FragmentModule { | |
| @ContributesAndroidInjector | |
| abstract fun contributesHomeFragment(): HomeFragment | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment