Newer
Older
DevAndroid / app / src / main / java / keijumt / devandroid / di / AppComponent.kt
package keijumt.devandroid.di

import android.app.Application
import dagger.BindsInstance
import dagger.Component
import dagger.android.AndroidInjector
import dagger.android.support.AndroidSupportInjectionModule
import keijumt.devandroid.App
import keijumt.devandroid.di.module.ActivityModule
import keijumt.devandroid.di.module.AppModule
import keijumt.devandroid.di.module.NetworkModule
import javax.inject.Singleton

@Singleton
@Component(modules = arrayOf(
        AndroidSupportInjectionModule::class,
        AppModule::class,
        NetworkModule::class,
        ActivityModule::class
))

/**
 * Component: Application 定義
 */
interface AppComponent : AndroidInjector<App> {

    @Component.Builder
    interface Builder {
        @BindsInstance
        fun application(application: Application): Builder

        fun build(): AppComponent
    }

    override fun inject(application: App)
}