├── .gitignore ├── .idea ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── elyeproj │ │ └── modular1bottombase │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── elyeproj │ │ │ └── modular1bottombase │ │ │ ├── AppDependent.kt │ │ │ ├── AppDependentModule.kt │ │ │ ├── MainActivity.kt │ │ │ └── MainComponent.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── elyeproj │ └── modular1bottombase │ └── ExampleUnitTest.kt ├── base ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── elyeproj │ │ └── base │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── elyeproj │ │ │ └── base │ │ │ ├── ActivityScope.kt │ │ │ ├── BaseApplication.kt │ │ │ ├── BaseComponent.kt │ │ │ ├── BaseNetwork.kt │ │ │ ├── BaseNetworkModule.kt │ │ │ ├── BaseRepository.kt │ │ │ └── BaseRepositoryModule.kt │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── elyeproj │ └── base │ └── ExampleUnitTest.java ├── build.gradle ├── featureone ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── elyeproj │ │ └── featureone │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── elyeproj │ │ │ └── featureone │ │ │ ├── FeatureOneActivity.kt │ │ │ ├── FeatureOneComponent.kt │ │ │ ├── FeatureOneDependent.kt │ │ │ └── FeatureOneDependentModule.kt │ └── res │ │ ├── layout │ │ └── activity_feature_one.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── elyeproj │ └── featureone │ └── ExampleUnitTest.java ├── featuretwo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── elyeproj │ │ └── featuretwo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── elyeproj │ │ │ └── featuretwo │ │ │ ├── FeatureTwoActivity.kt │ │ │ ├── FeatureTwoComponent.kt │ │ │ ├── FeatureTwoDependent.kt │ │ │ └── FeatureTwoDependentModule.kt │ └── res │ │ ├── layout │ │ └── activity_feature_two.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── elyeproj │ └── featuretwo │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion 28 8 | defaultConfig { 9 | applicationId "com.elyeproj.modular1bottombase" 10 | minSdkVersion 21 11 | targetSdkVersion 28 12 | versionCode 1 13 | versionName "1.0" 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | implementation project(':base') 27 | implementation project(':featureone') 28 | implementation project(':featuretwo') 29 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 30 | implementation 'com.android.support:appcompat-v7:28.0.0' 31 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 32 | implementation "com.google.dagger:dagger:$daggerVersion" 33 | kapt "com.google.dagger:dagger-compiler:$daggerVersion" 34 | testImplementation 'junit:junit:4.12' 35 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 36 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 37 | } 38 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/elyeproj/modular1bottombase/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.elyeproj.modular1bottombase 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.elyeproj.modular1bottombase", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/elyeproj/modular1bottombase/AppDependent.kt: -------------------------------------------------------------------------------- 1 | package com.elyeproj.modular1bottombase 2 | 3 | import com.elyeproj.base.BaseNetwork 4 | import com.elyeproj.base.BaseRepository 5 | 6 | class AppDependent(val name: String, private val baseRepository: BaseRepository, private val baseNetwork: BaseNetwork) { 7 | override fun toString(): String { 8 | return "AppDependent $name ${super.toString()} with\n$baseRepository and\n$baseNetwork" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/elyeproj/modular1bottombase/AppDependentModule.kt: -------------------------------------------------------------------------------- 1 | package com.elyeproj.modular1bottombase 2 | 3 | import com.elyeproj.base.BaseNetwork 4 | import com.elyeproj.base.BaseRepository 5 | import dagger.Module 6 | import dagger.Provides 7 | import javax.inject.Named 8 | 9 | @Module 10 | class AppDependentModule(private val prefix: String, private val postfix: String) { 11 | 12 | @Provides @Named("prefix") 13 | fun getPrefixText() = prefix 14 | 15 | @Provides @Named("postfix") 16 | fun getPostfixText() = postfix 17 | 18 | @Provides 19 | fun appModel(@Named("prefix") prefix: String, 20 | @Named("postfix") postfix: String, 21 | baseRepository: BaseRepository, baseNetwork: BaseNetwork) = 22 | AppDependent("$prefix $postfix", baseRepository, baseNetwork) 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/elyeproj/modular1bottombase/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.elyeproj.modular1bottombase 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import android.support.v7.app.AppCompatActivity 6 | import com.elyeproj.base.BaseApplication 7 | import com.elyeproj.featureone.FeatureOneActivity 8 | import com.elyeproj.featuretwo.FeatureTwoActivity 9 | import kotlinx.android.synthetic.main.activity_main.* 10 | import javax.inject.Inject 11 | 12 | class MainActivity : AppCompatActivity() { 13 | 14 | @Inject 15 | lateinit var appDependent: AppDependent 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | setContentView(R.layout.activity_main) 20 | 21 | DaggerMainComponent.builder() 22 | .baseComponent(BaseApplication.baseComponent) 23 | .appDependentModule(AppDependentModule("first", "last")) 24 | .build() 25 | .inject(this) 26 | 27 | txt_result.text = "I have get my dependents from\n$appDependent" 28 | 29 | button_one.setOnClickListener { 30 | startActivity(Intent(this, FeatureOneActivity::class.java)) 31 | } 32 | 33 | button_two.setOnClickListener { 34 | startActivity(Intent(this, FeatureTwoActivity::class.java)) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/elyeproj/modular1bottombase/MainComponent.kt: -------------------------------------------------------------------------------- 1 | package com.elyeproj.modular1bottombase 2 | 3 | import com.elyeproj.base.ActivityScope 4 | import com.elyeproj.base.BaseComponent 5 | import dagger.Component 6 | 7 | @ActivityScope 8 | @Component(dependencies = [BaseComponent::class], modules = [AppDependentModule::class]) 9 | interface MainComponent { 10 | fun inject(mainActivity: MainActivity) 11 | 12 | @Component.Builder 13 | interface Builder { 14 | fun build(): MainComponent 15 | fun appDependentModule(appDependentModule: AppDependentModule): Builder 16 | fun baseComponent(baseComponent: BaseComponent): Builder 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 |