Skip to content

Instantly share code, notes, and snippets.

@Tagakov
Last active January 16, 2020 15:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tagakov/168cdef4d4ee6be69a549eba7f5fa224 to your computer and use it in GitHub Desktop.
Save Tagakov/168cdef4d4ee6be69a549eba7f5fa224 to your computer and use it in GitHub Desktop.
template for adding new controller to DI graph
typealias YourController = ListEditorController
//do not forget to rename component and module
//do not forget to add module to parent component
//do not forget to add HasControllerInjector to parent entity [Application, Activity, Controller] if not present
@Subcomponent(modules = [ComponentModule::class])
interface RenameMeComponent : AndroidInjector<YourController> {
@Subcomponent.Builder
abstract class Builder : AndroidInjector.Builder<YourController>()
}
@Module(subcomponents = [RenameMeComponent::class])
abstract class RenameMeModule {
@Binds
@IntoMap
@ControllerKey(YourController::class)
abstract fun bindInjector(builder: RenameMeComponent.Builder): AndroidInjector.Factory<out Controller>
}
private class ComponentModule {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment