![Page 1: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/1.jpg)
Anahí Salgado@anncode
![Page 2: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/2.jpg)
Inyección de DependenciasDagger Hilt
@anncode
![Page 3: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/3.jpg)
Dagger
@anncode
![Page 4: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/4.jpg)
Inyección de Dependencias
@anncode
![Page 5: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/5.jpg)
Inyección de Dependencias
Para que un objeto exista necesita la existencia de otro u otros
@anncode
![Page 6: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/6.jpg)
Inyección de Dependencias
Para que un objeto exista necesita la existencia de otro u otros
@anncode
![Page 7: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/7.jpg)
Inyección de dependencias
Agenda
✔
@anncode
![Page 8: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/8.jpg)
Inyección de dependencias
Agenda- Contact
✔
@anncode
![Page 9: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/9.jpg)
Inyección de dependencias
Agenda- contacts: List<Contact>- type: String
✔
Contact- name: String- phone: String
@anncode
![Page 10: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/10.jpg)
Inyección de dependencias
Agenda- contacts: List<Contact>- type: String
✔
Contact- name: String- phone: StringPara que un objeto exista
necesita la existencia de otro u otros @anncode
![Page 11: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/11.jpg)
![Page 12: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/12.jpg)
Inyección de dependenciaAgendaFriends
✔
@anncode
![Page 13: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/13.jpg)
Inyección de dependenciaAgendaFriends
✔
AgendaFamily
@anncode
![Page 14: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/14.jpg)
Inyección de dependenciaAgendaFriends
✔
AgendaFamily
AgendaTeamWork
@anncode
![Page 15: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/15.jpg)
Inyección de Dependencias
Tratamos que los objetos no dependan tanto entre ellos para hacer más flexible los sistemas
@anncode
![Page 16: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/16.jpg)
Inyección de dependencias
data class Agenda(val type: String, val contacts: List<Contact>)
✔
@anncode
![Page 17: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/17.jpg)
Inyección de dependencias
data class Agenda(val type: String, val contacts: List<Contact>)
✔
@anncode
![Page 18: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/18.jpg)
Inyección de dependencias
data class Agenda(val type: String, val contacts: List<Contact>)
✔
@anncode
![Page 19: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/19.jpg)
Inyección de dependencias
data class Agenda(val type: String, val contacts: List<Contact>)
✔Inyectar
@anncode
![Page 20: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/20.jpg)
![Page 21: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/21.jpg)
Inyección de Dependencias
Reutilización de código
@anncode
![Page 22: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/22.jpg)
Inyección de dependencias
data class Agenda(val type: String, val contacts: List<Contact>)
✔
@anncode
![Page 23: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/23.jpg)
Dagger
@anncode
![Page 24: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/24.jpg)
DaggerKoin
@anncode
![Page 25: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/25.jpg)
DaggerKoin
Dagger Hilt@anncode
![Page 26: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/26.jpg)
Dagger Hilt
@anncode
![Page 27: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/27.jpg)
Dagger Hiltapply plugin: 'kotlin-kapt' build.gradle(:app)
apply plugin: 'dagger.hilt.android.plugin'
dependencies { def hilt_version = "2.28-alpha"
// Dagger Hilt implementation "com.google.dagger:hilt-android:$hilt_version" kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
}
dependencies { build.gradle(project) classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
} @anncode
![Page 28: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/28.jpg)
Dagger Hilt
@HiltAndroidAppopen class MyApplication: Application()
@anncode
![Page 29: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/29.jpg)
Dagger Hilt
@HiltAndroidAppopen class MyApplication: Application()
AndroidManifest.xml
<application android:name=".MyApplication"
@anncode
![Page 30: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/30.jpg)
Dagger Hilt
@anncode
![Page 31: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/31.jpg)
Dagger Hilt
fun provideListContacts(): List<Contact> {
@anncode
![Page 32: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/32.jpg)
Dagger Hilt
@Providesfun provideListContacts(): List<Contact> {
@anncode
![Page 33: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/33.jpg)
Dagger Hilt
@Providesfun provideListContacts(): List<Contact> {
@Providesfun providesAgenda(contacts: List<Contact>): Agenda
@anncode
![Page 34: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/34.jpg)
Dagger Hilt
class AgendaModule {
@anncode
![Page 35: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/35.jpg)
Dagger Hilt
class AgendaModule {
@anncode
![Page 36: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/36.jpg)
Dagger Hilt
@Moduleclass AgendaModule {
@anncode
![Page 37: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/37.jpg)
Dagger Hilt
@anncode
![Page 38: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/38.jpg)
Dagger Hilt
@Moduleclass AgendaModule {
Scope
@anncode
![Page 39: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/39.jpg)
Dagger Hilt
@Module@InstallIn(ApplicationComponent::class)class AgendaModule {
Scope
@anncode
![Page 40: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/40.jpg)
Dagger Hilt@Module@InstallIn(ApplicationComponent::class)class AgendaModule {
ApplicationComponentApplication
@anncode
![Page 41: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/41.jpg)
Dagger Hilt@Module@InstallIn(ServiceComponent::class)class AgendaModule {
ApplicationComponentApplication
ServiceComponentService
@anncode
![Page 42: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/42.jpg)
Dagger Hilt@Module@InstallIn(ActivityRetainedComponent::class)class AgendaModule {
ApplicationComponentApplication
ServiceComponentService
ActivityRetainedComponentViewModel
@anncode
![Page 43: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/43.jpg)
Dagger Hilt@Module@InstallIn(ActivityComponent::class)class AgendaModule {
ApplicationComponentApplication
ServiceComponentService
ActivityComponentActivity
ActivityRetainedComponentViewModel
@anncode
![Page 44: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/44.jpg)
Dagger Hilt@Module@InstallIn(ViewComponent::class)class AgendaModule {
ApplicationComponentApplication
ServiceComponentService
ActivityComponentActivity
ViewComponent
View
ViewComponent
View
ActivityRetainedComponentViewModel
@anncode
![Page 45: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/45.jpg)
Dagger Hilt@Module@InstallIn(FragmentComponent::class)class AgendaModule {
ApplicationComponentApplication
ServiceComponentService
ActivityComponentActivity
ViewComponent
View
ViewComponent
View
FragmentComponentFragment
FragmentComponentFragment
ActivityRetainedComponentViewModel
@anncode
![Page 46: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/46.jpg)
Dagger Hilt ApplicationComponentApplication
ServiceComponentService
ActivityComponentActivity
ViewComponent
View
ViewComponent
View
FragmentComponentFragment
FragmentComponentFragment
ActivityRetainedComponentViewModel
@Module@InstallIn(ViewWithFragmentComponent::class)class AgendaModule {
@anncode
![Page 47: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/47.jpg)
Dagger Hilt@Module@InstallIn(ViewWithFragmentComponent::class)class AgendaModule {
ApplicationComponentApplication
ServiceComponentService
ActivityComponentActivity
ViewComponent
View
ViewComponent
View
FragmentComponentFragment
FragmentComponentFragment
ViewWithFragment
ComponentViewFragment
ActivityRetainedComponentViewModel
@anncode
![Page 48: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/48.jpg)
Dagger Hilt
@Module@InstallIn(ApplicationComponent::class)class AgendaModule {
@anncode
![Page 49: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/49.jpg)
Dagger Hilt
@AndroidEntryPointclass MainActivity : AppCompatActivity() {
@anncode
![Page 50: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/50.jpg)
Dagger Hilt
@AndroidEntryPointclass MainActivity : AppCompatActivity() {
ActivityFragmentViewServiceBroadcast Receiver
@anncode
![Page 51: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/51.jpg)
Dagger Hilt
@AndroidEntryPointclass MainActivity : AppCompatActivity() {
@Inject lateinit var contacts: List<Contact>
@anncode
![Page 52: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/52.jpg)
Dagger Hilt
@AndroidEntryPointclass MainActivity : AppCompatActivity() {
@Inject lateinit var contacts: List<Contact>
@Inject lateinit var agenda: Agenda
@anncode
![Page 53: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/53.jpg)
Dagger Hilt@Inject lateinit var contacts: List<Contact>
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) contacts.forEach {
}}
@anncode
![Page 54: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/54.jpg)
![Page 55: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/55.jpg)
ApiService Repository
Data layer
UseCase
Domain layer
ViewModel ActivityFragment
Presentation layer
Arquitectura
@anncode
![Page 56: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/56.jpg)
ApiService Repository
Data layer
UseCase
Domain layer
ViewModel ActivityFragment
Presentation layer
NetworkModule
provideApiService
RepositoryModule
provideXRepository
Arquitectura
@anncode
![Page 57: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/57.jpg)
ApiService Repository
Data layer
NetworkModule
provideApiService
RepositoryModule
provideXRepository
Arquitectura
@anncode
![Page 58: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/58.jpg)
ApiService Repository
Data layer
UseCase
Domain layer
ViewModel ActivityFragment
Presentation layer
NetworkModule
provideApiService
RepositoryModule
provideXRepository
Arquitectura
UseCaseModule
provideXUseCase
@anncode
![Page 59: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/59.jpg)
Arquitectura
UseCase
Domain layer
UseCaseModule
provideXUseCase
@anncode
![Page 60: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/60.jpg)
ApiService Repository
Data layer
UseCase
Domain layer
ViewModel ActivityFragment
Presentation layer
NetworkModule
provideApiService
RepositoryModule
provideXRepository
Arquitectura
UseCaseModule
provideXUseCase
ViewModelModule
provideXViewModel
@anncode
![Page 61: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/61.jpg)
Arquitectura
ViewModel ActivityFragment
Presentation layer
ViewModelModule
provideXViewModel
@anncode
![Page 62: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/62.jpg)
Dagger Hilt
class MainViewModel @ViewModelInject constructor( private val getCatRandomFact: GetCatRandomFact
): ViewModel() {
@anncode
![Page 63: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/63.jpg)
Dagger Hilt
class MainViewModel @ViewModelInject constructor( private val getCatRandomFact: GetCatRandomFact
): ViewModel() {
class Factory( private val getCatRandomFact: GetCatRandomFact): ViewModelProvider.Factory {
@anncode
![Page 64: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/64.jpg)
Dagger Hilt
class MainViewModel @ViewModelInject constructor( private val getCatRandomFact: GetCatRandomFact
): ViewModel() {
class Factory( private val getCatRandomFact: GetCatRandomFact): ViewModelProvider.Factory {
@anncode
![Page 65: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/65.jpg)
Dagger Hilt
class MyWorkerModel @WorkerInject constructor( @Assited context: Context
): Worker() {
@anncode
![Page 66: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/66.jpg)
Dagger Hilt
class MyWorkerModel @WorkerInject constructor( @Assited context: Context
): Worker() {
class Factory(): WorkerFactory {
@anncode
![Page 67: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/67.jpg)
Dagger Hilt
class MyWorkerModel @WorkerInject constructor( @Assited context: Context
): Worker() {
class Factory(): WorkerFactory {
@anncode
![Page 68: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/68.jpg)
https://medium.com/androiddevelopers/dependency-injection-on-android-with-hilt-67
b6031e62d@anncode
![Page 69: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/69.jpg)
https://medium.com/androiddevelopers/dependency-injection-on-android-with-hilt-67
b6031e62d@anncode
![Page 70: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/70.jpg)
https://medium.com/androiddevelopers/dependency-injection-on-android-with-hilt-67
b6031e62d@anncode
![Page 71: Anahí Salgado³n-de... · Dagger Hilt apply plugin: 'kotlin-kapt' build.gradle(:app) apply plugin: 'dagger.hilt.android.plugin' dependencies {def hilt_version = "2.28-alpha"](https://reader033.vdocuments.pub/reader033/viewer/2022042506/5f8c655de8062c0f2643a99f/html5/thumbnails/71.jpg)
Anahí Salgado@anncode