Created
January 14, 2022 06:35
-
-
Save vikasmain/af5bd272b13484005781c21218ffe1c0 to your computer and use it in GitHub Desktop.
This file contains 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
@Subcomponent(modules = [MovieActivityModule::class]) | |
@MovieActivityScope | |
interface MovieComponent { | |
fun inject(movieActivity: MovieActivity) | |
@Subcomponent.Builder | |
interface Builder { | |
@BindsInstance | |
fun activity(appCompatActivity: AppCompatActivity): Builder | |
@BindsInstance | |
fun movieView(movieView: MovieContract.MovieView): Builder | |
fun build(): MovieComponent | |
} | |
} | |
@Module | |
class MovieActivityModule { | |
companion object { | |
@Provides | |
@MovieActivityScope | |
fun providesBinding(appCompatActivity: AppCompatActivity): ActivityMainBinding { | |
return ActivityMainBinding.inflate(appCompatActivity.layoutInflater) | |
} | |
@Provides | |
@MovieActivityScope | |
fun providesCoroutineScope(): CoroutineScope{ | |
return MainScope() + CoroutineName("MovieCoroutine") | |
} | |
} | |
} | |
@Scope | |
@Retention(AnnotationRetention.SOURCE) | |
internal annotation class MovieActivityScope |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment