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
open class BaseApplication : DaggerApplication() { | |
override fun applicationInjector(): AndroidInjector<out DaggerApplication> { | |
return initializeDaggerComponent() | |
} | |
open fun initializeDaggerComponent(): AppComponent { | |
val component: AppComponent = DaggerAppComponent.factory() | |
.create(this) | |
component.inject(this) | |
return component | |
} |
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
@Singleton | |
@Component( | |
modules = [ | |
AndroidInjectionModule::class, NetworkModule::class, | |
AppModule::class, AppModuleBinds::class, | |
ViewModelBuilderModule::class, ActivityBuildersModule::class | |
] | |
) | |
interface AppComponent : AndroidInjector<DaggerApplication> { | |
@Component.Factory |
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
@Module | |
class NetworkModule { | |
@Singleton | |
@Provides | |
fun provideHttpLoggingInterceptor(): HttpLoggingInterceptor { | |
return HttpLoggingInterceptor() | |
.setLevel(HttpLoggingInterceptor.Level.BODY) | |
} | |
@Singleton | |
@Provides |
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
@Module | |
interface AppModuleBinds { | |
@Singleton | |
@Binds | |
fun bindRepository(defaultDataRepository: DefaultDataRepository): DataRepository | |
} |
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
@Module | |
class AppModule { | |
@Singleton | |
@Provides | |
fun provideTasksRemoteDataSource( | |
apiService: ApiService | |
): DataSource { | |
return RemoteDataSource(apiService) | |
} | |
} |
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
@Module() | |
interface ActivityBuildersModule { | |
@ActivityScope | |
@ContributesAndroidInjector(modules = [LoginModule::class, LoginFragmentsBuilderModule::class]) | |
fun contributeMainActivity(): MainActivity | |
} |
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
package com.example.myapplication | |
import android.app.AlertDialog | |
import android.app.Dialog | |
import android.content.Context | |
import android.os.Bundle | |
import android.text.TextUtils | |
import androidx.fragment.app.DialogFragment | |
/** |
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
def setupAndroidReporting() { | |
// 1 | |
tasks.withType(Test) { | |
// Whether or not classes without source location should be instrumented | |
jacoco.includeNoLocationClasses true | |
} | |
// Grab all build types and product flavors | |
// 2 | |
def buildTypes = android.buildTypes.collect { type -> |
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
apply plugin: 'com.android.library' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-kapt' | |
apply plugin: 'kotlin-android-extensions' | |
apply plugin: 'jacoco' | |
apply from: "$project.rootDir/tools/script-jacoco.gradle" | |
android { | |
// Code omitted for brevity |
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
apply plugin: 'java-library' | |
apply plugin: 'kotlin' | |
apply plugin: 'kotlin-kapt' | |
apply plugin: 'jacoco' | |
apply from: "$project.rootDir/tools/script-jacoco.gradle" | |
dependencies { | |
// Code omitted for brevity | |
} |