Convert AppComponent to Kotlin
This commit is contained in:
parent
927bdb9546
commit
02069d8737
2 changed files with 28 additions and 35 deletions
|
@ -1,35 +0,0 @@
|
||||||
package com.wbrawner.simplemarkdown;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.view.activity.MainActivity;
|
|
||||||
import com.wbrawner.simplemarkdown.view.activity.SplashActivity;
|
|
||||||
import com.wbrawner.simplemarkdown.view.fragment.EditFragment;
|
|
||||||
import com.wbrawner.simplemarkdown.view.fragment.PreviewFragment;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import dagger.BindsInstance;
|
|
||||||
import dagger.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by billy on 8/22/17.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Component(modules = { AppModule.class })
|
|
||||||
public interface AppComponent {
|
|
||||||
void inject(MarkdownApplication application);
|
|
||||||
void inject(MainActivity activity);
|
|
||||||
void inject(SplashActivity activity);
|
|
||||||
void inject(EditFragment fragment);
|
|
||||||
void inject(PreviewFragment fragment);
|
|
||||||
|
|
||||||
@Component.Builder
|
|
||||||
abstract class Builder {
|
|
||||||
@BindsInstance
|
|
||||||
abstract Builder context(Context context);
|
|
||||||
|
|
||||||
abstract AppComponent build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.wbrawner.simplemarkdown
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.wbrawner.simplemarkdown.view.activity.MainActivity
|
||||||
|
import com.wbrawner.simplemarkdown.view.activity.SplashActivity
|
||||||
|
import com.wbrawner.simplemarkdown.view.fragment.EditFragment
|
||||||
|
import com.wbrawner.simplemarkdown.view.fragment.PreviewFragment
|
||||||
|
import dagger.BindsInstance
|
||||||
|
import dagger.Component
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Component(modules = [AppModule::class])
|
||||||
|
interface AppComponent {
|
||||||
|
fun inject(application: MarkdownApplication)
|
||||||
|
fun inject(activity: MainActivity)
|
||||||
|
fun inject(activity: SplashActivity)
|
||||||
|
fun inject(fragment: EditFragment)
|
||||||
|
fun inject(fragment: PreviewFragment)
|
||||||
|
|
||||||
|
@Component.Builder
|
||||||
|
abstract class Builder {
|
||||||
|
@BindsInstance
|
||||||
|
internal abstract fun context(context: Context): Builder
|
||||||
|
|
||||||
|
internal abstract fun build(): AppComponent
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue