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
@AssistedModule | |
@Module(includes = [AssistedInject_AssistedInjectModule::class]) | |
interface AssistedInjectModule |
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
private val presenter by lazy { | |
component.textPresenterFactory.create(this, intent.getStringExtra(EXTRA_TEXT)) | |
} |
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
class SimpleAssistedInjectApplication : Application() { | |
val component: ApplicationComponent by lazy { | |
DaggerApplicationComponent.builder() | |
.applicationContext(applicationContext) | |
.build() | |
} | |
} | |
val Activity.component get() = (application as SimpleAssistedInjectApplication).component |
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
class TextPresenter @AssistedInject constructor( | |
@Assisted private val view: TextView, | |
@Assisted @Text private val text: String, | |
private val textDecorator: TextDecorator | |
) { | |
@AssistedInject.Factory | |
interface Factory { | |
fun create(view: TextView, @Text text: String): TextPresenter | |
} |
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
@AssistedModule | |
@Module(includes = [AssistedInject_ApplicationModule::class]) | |
object ApplicationModule { | |
... | |
} |
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 = [AssistedInjectModule::class]) | |
interface ApplicationComponent { | |
... | |
val textPresenterFactory: TextPresenter.Factory | |
} |
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
DaggerApplicationComponent | |
.builder() | |
.applicationModule(ApplicationModule(applicationContext)) | |
.build() |
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
@Component(modules = ...) | |
interface ApplicationComponent { | |
@Component.Builder | |
interface Builder { | |
@BindsInstance fun applicationContext(applicationContext: Context): Builder | |
fun build(): ApplicationComponent | |
} | |
... |
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
@Component(modules = ...) | |
interface ApplicationComponent { | |
@Component.Factory | |
interface Factory { | |
fun create(@BindsInstance applicationContext: Context): ApplicationComponent | |
} | |
... | |
} |
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
DaggerApplicationComponent | |
.factory() | |
.create(applicationContext) |