diff --git a/android-studio-plugin/InFullMvpActivityJava_dagger2.11+/template.xml b/android-studio-plugin/InFullMvpActivityJava_dagger2.11+/template.xml index ab8881a..d693b93 100644 --- a/android-studio-plugin/InFullMvpActivityJava_dagger2.11+/template.xml +++ b/android-studio-plugin/InFullMvpActivityJava_dagger2.11+/template.xml @@ -40,12 +40,6 @@ suggest="${applicationPackage}" help="Path to .R of this app/module" /> - +import android.app.Fragment +import dagger.android.HasFragmentInjector + +<#if addDispatchingSupportFragmentInjector> +import dagger.android.support.HasSupportFragmentInjector +import android.support.v4.app.Fragment as SupportFragment + import javax.inject.Inject -class ${applicationClass} : Application(), HasActivityInjector { +class ${applicationClass} : Application(), HasActivityInjector<#if addDispatchingFragmentInjector>, HasFragmentInjector<#if addDispatchingSupportFragmentInjector>, HasSupportFragmentInjector { - @Inject lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector + @Inject lateinit var dispatchingActivityInjector: DispatchingAndroidInjector + <#if addDispatchingFragmentInjector> + @Inject lateinit var dispatchingFragmentInjector: DispatchingAndroidInjector + + <#if addDispatchingSupportFragmentInjector> + @Inject lateinit var dispatchingSupportFragmentInjector: DispatchingAndroidInjector + override fun onCreate() { super.onCreate() @@ -20,5 +34,14 @@ class ${applicationClass} : Application(), HasActivityInjector { .inject(this) } - override fun activityInjector(): AndroidInjector = dispatchingAndroidInjector + override fun activityInjector(): AndroidInjector = dispatchingActivityInjector + <#if addDispatchingFragmentInjector> + + override fun fragmentInjector(): AndroidInjector = dispatchingFragmentInjector + + <#if addDispatchingSupportFragmentInjector> + + override fun supportFragmentInjector(): AndroidInjector = dispatchingSupportFragmentInjector + + } \ No newline at end of file diff --git a/android-studio-plugin/InfullAplicationKotlin_dagger2.11+/template.xml b/android-studio-plugin/InfullAplicationKotlin_dagger2.11+/template.xml index a1e15ad..8f3feaa 100644 --- a/android-studio-plugin/InfullAplicationKotlin_dagger2.11+/template.xml +++ b/android-studio-plugin/InfullAplicationKotlin_dagger2.11+/template.xml @@ -40,6 +40,20 @@ type="string" visibility="useApplicationComponent"/> + + + + ifmdagger.png diff --git a/android-studio-plugin/template_usecause.png b/android-studio-plugin/template_usecause.png index 36764a8..649740c 100644 Binary files a/android-studio-plugin/template_usecause.png and b/android-studio-plugin/template_usecause.png differ diff --git a/sample-kotlin-dagger-2.1x/src/main/java/com/infullmobile/android/infullmvp/sample_dagger21x/application/SampleApp.kt b/sample-kotlin-dagger-2.1x/src/main/java/com/infullmobile/android/infullmvp/sample_dagger21x/application/SampleApp.kt index ac5ace5..684b120 100644 --- a/sample-kotlin-dagger-2.1x/src/main/java/com/infullmobile/android/infullmvp/sample_dagger21x/application/SampleApp.kt +++ b/sample-kotlin-dagger-2.1x/src/main/java/com/infullmobile/android/infullmvp/sample_dagger21x/application/SampleApp.kt @@ -6,11 +6,16 @@ import com.infullmobile.android.infullmvp.sample_dagger21x.application.di.Dagger import dagger.android.AndroidInjector import dagger.android.DispatchingAndroidInjector import dagger.android.HasActivityInjector +import dagger.android.HasFragmentInjector +import dagger.android.support.HasSupportFragmentInjector +import android.support.v4.app.Fragment as SupportFragment import javax.inject.Inject -class SampleApp : Application(), HasActivityInjector { +class SampleApp : Application(), HasActivityInjector, HasSupportFragmentInjector, HasFragmentInjector { @Inject lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector + @Inject lateinit var dispatchingSupportFragmentInjector: DispatchingAndroidInjector + @Inject lateinit var dispatchingFragmentInjector: DispatchingAndroidInjector override fun onCreate() { super.onCreate() @@ -22,4 +27,8 @@ class SampleApp : Application(), HasActivityInjector { override fun activityInjector(): AndroidInjector = dispatchingAndroidInjector + override fun fragmentInjector(): AndroidInjector = dispatchingFragmentInjector + + override fun supportFragmentInjector(): AndroidInjector = dispatchingSupportFragmentInjector + } \ No newline at end of file