├── login
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ └── strings.xml
│ │ └── layout
│ │ │ └── activity_log_in.xml
│ │ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── mydogtom
│ │ │ └── login
│ │ │ ├── LogInView.kt
│ │ │ ├── LoginPresenter.kt
│ │ │ ├── LoginComponent.kt
│ │ │ └── LogInActivity.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ └── styles.xml
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── layout
│ │ │ └── activity_main.xml
│ │ └── drawable
│ │ │ └── ic_launcher_background.xml
│ │ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── mydogtom
│ │ │ └── multimoduleexample
│ │ │ ├── MainActivityComponent.kt
│ │ │ ├── MainActivity.kt
│ │ │ └── App.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── base-app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── mydogtom
│ │ └── baseapp
│ │ ├── FeatureScope.kt
│ │ ├── LoggedInScope.kt
│ │ ├── SubComponentsBindigsModule.kt
│ │ ├── LoggedInComponent.kt
│ │ └── LoggedOutComponent.kt
├── proguard-rules.pro
└── build.gradle
├── persistence
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── mydogtom
│ │ │ └── persistence
│ │ │ ├── UserName.kt
│ │ │ ├── Storage.kt
│ │ │ └── UserRepository.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── login-navigator
├── .gitignore
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── mydogtom
│ │ └── login
│ │ └── navigator
│ │ ├── LoginNavigatorModule.kt
│ │ └── LoginNavigator.kt
├── proguard-rules.pro
└── build.gradle
├── user-details
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ └── strings.xml
│ │ └── layout
│ │ │ └── activity_user_details.xml
│ │ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── mydogtom
│ │ │ └── userdetails
│ │ │ ├── UserDetailsView.kt
│ │ │ ├── UserDetailsComponent.kt
│ │ │ ├── UserDetailsPresenter.kt
│ │ │ └── UserDetailsActivity.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── user-details-navigator
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── mydogtom
│ │ └── userdetailsnavigator
│ │ └── UserDetailsNavigator.kt
├── proguard-rules.pro
└── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── settings.gradle
├── .idea
├── encodings.xml
├── vcs.xml
├── runConfigurations.xml
├── modules.xml
├── misc.xml
├── codeStyleSettings.xml
└── inspectionProfiles
│ └── Project_Default.xml
├── detekt.yml
├── gradle.properties
├── dependencies.gradle
├── gradlew.bat
├── .gitignore
├── gradlew
└── README.md
/login/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
3 |
--------------------------------------------------------------------------------
/base-app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/persistence/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/login-navigator/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/user-details/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/user-details-navigator/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/login/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Login
3 |
4 |
--------------------------------------------------------------------------------
/base-app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BaseApp
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MultiModuleExample
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/persistence/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Persistence
3 |
4 |
--------------------------------------------------------------------------------
/user-details/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | UserDetails
3 |
4 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':persistence', ':login', ':login-navigator', ':base-app', ':user-details', ':user-details-navigator'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/user-details-navigator/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | user-details
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/base-app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/persistence/src/main/java/com/github/mydogtom/persistence/UserName.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.persistence
2 |
3 | data class UserName(val name: String)
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/login/src/main/java/com/github/mydogtom/login/LogInView.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.login
2 |
3 | interface LogInView{
4 | fun navigateToUserDetails()
5 | }
6 |
--------------------------------------------------------------------------------
/persistence/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/login-navigator/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyDogTom/MultiModuleExample/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/login-navigator/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LoginNavigator
3 | login
4 |
5 |
--------------------------------------------------------------------------------
/user-details-navigator/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/base-app/src/main/java/com/github/mydogtom/baseapp/FeatureScope.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.baseapp
2 |
3 | import javax.inject.Scope
4 |
5 | @Scope
6 | annotation class FeatureScope
7 |
--------------------------------------------------------------------------------
/base-app/src/main/java/com/github/mydogtom/baseapp/LoggedInScope.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.baseapp
2 |
3 | import javax.inject.Scope
4 |
5 | @Scope
6 | annotation class LoggedInScope
7 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/base-app/src/main/java/com/github/mydogtom/baseapp/SubComponentsBindigsModule.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.baseapp
2 |
3 | import dagger.Module
4 |
5 | @Module(subcomponents = arrayOf(LoggedInComponent::class))
6 | class SubComponentsBindigsModule
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/user-details/src/main/java/com/github/mydogtom/userdetails/UserDetailsView.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.userdetails
2 |
3 | import com.github.mydogtom.persistence.UserName
4 |
5 | interface UserDetailsView {
6 | fun showData(userName: UserName)
7 | fun showAddress(address: String)
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/detekt.yml:
--------------------------------------------------------------------------------
1 | autoCorrect: false
2 | failFast: true
3 |
4 | comments:
5 | UndocumentedPublicClass:
6 | active: false
7 | UndocumentedPublicFunction:
8 | active: false
9 |
10 | potential-bugs:
11 | LateinitUsage:
12 | active: true
13 | excludeAnnotatedProperties: 'Inject'
14 | ignoreOnClassesPattern: ''
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/login-navigator/src/main/java/com/github/mydogtom/login/navigator/LoginNavigatorModule.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.login.navigator
2 |
3 | import dagger.Module
4 | import dagger.Provides
5 |
6 | @Module
7 | class LoginNavigatorModule {
8 |
9 | @Provides
10 | fun provideNavigator():LoginNavigator = LoginNavigator()
11 | }
12 |
--------------------------------------------------------------------------------
/login/src/main/java/com/github/mydogtom/login/LoginPresenter.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.login
2 |
3 | import com.github.mydogtom.persistence.UserRepository
4 |
5 | class LoginPresenter(private val userRepository: UserRepository, private val view: LogInView) {
6 | fun performLogIn(name: String) {
7 | userRepository.setUserName(name)
8 | view.navigateToUserDetails()
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/persistence/src/main/java/com/github/mydogtom/persistence/Storage.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.persistence
2 |
3 | class Storage {
4 | private val values = HashMap()
5 |
6 | @Suppress("UNCHECKED_CAST", "UnsafeCast")
7 | fun getValue(key: String): T? = values[key] as T?
8 |
9 | fun putValue(key: String, value: Any) {
10 | values.put(key, value)
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/mydogtom/multimoduleexample/MainActivityComponent.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.multimoduleexample
2 |
3 | import com.github.mydogtom.login.navigator.LoginNavigatorModule
4 | import dagger.Component
5 | import dagger.Module
6 | import dagger.Subcomponent
7 |
8 | @Component(modules = arrayOf(LoginNavigatorModule::class))
9 | interface MainActivityComponent {
10 | fun inject(activity: MainActivity)
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/login-navigator/src/main/java/com/github/mydogtom/login/navigator/LoginNavigator.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.login.navigator
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.net.Uri
6 |
7 | class LoginNavigator {
8 | fun openLogin(context: Context) {
9 | val path = context.getString(R.string.login_path)
10 | val startActivityIntent = Intent(Intent.ACTION_VIEW, Uri.parse("s-urn://$path"))
11 | context.startActivity(startActivityIntent)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/user-details-navigator/src/main/java/com/github/mydogtom/userdetailsnavigator/UserDetailsNavigator.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.userdetailsnavigator
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.net.Uri
6 | import javax.inject.Inject
7 |
8 | class UserDetailsNavigator @Inject constructor() {
9 | fun openUserDetails(context: Context) {
10 | val path = context.getString(R.string.user_details_path)
11 | val intent = Intent(Intent.ACTION_VIEW, Uri.parse("s-urn://$path"))
12 | context.startActivity(intent)
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/login/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/user-details/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/persistence/src/main/java/com/github/mydogtom/persistence/UserRepository.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.persistence
2 |
3 | private const val FIELD_USER_NAME = "user.name"
4 | private const val FIELD_USER_ADDRESS = "user.address"
5 | class UserRepository(private val storage: Storage) {
6 |
7 | fun setUserName(name: String) {
8 | storage.putValue(FIELD_USER_NAME, name)
9 | }
10 |
11 | fun getUserName(): UserName = UserName(storage.getValue(FIELD_USER_NAME).orEmpty())
12 |
13 |
14 | fun setAddress(address: String) {
15 | storage.putValue(FIELD_USER_ADDRESS, address)
16 | }
17 |
18 | fun getAddress(): String = storage.getValue(FIELD_USER_ADDRESS).orEmpty()
19 | }
20 |
--------------------------------------------------------------------------------
/user-details/src/main/java/com/github/mydogtom/userdetails/UserDetailsComponent.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.userdetails
2 |
3 | import com.github.mydogtom.baseapp.FeatureScope
4 | import com.github.mydogtom.baseapp.LoggedInComponent
5 | import dagger.BindsInstance
6 | import dagger.Component
7 |
8 | @Component(dependencies = arrayOf(LoggedInComponent::class))
9 | @FeatureScope
10 | interface UserDetailsComponent {
11 | fun inject(activity: UserDetailsActivity)
12 |
13 | @Component.Builder
14 | interface Builder {
15 | @BindsInstance
16 | fun userDetailsView(view: UserDetailsView): Builder
17 |
18 | fun loggedInComponent(component: LoggedInComponent): Builder
19 | fun build(): UserDetailsComponent
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/user-details/src/main/java/com/github/mydogtom/userdetails/UserDetailsPresenter.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.userdetails
2 |
3 | import com.github.mydogtom.baseapp.FeatureScope
4 | import com.github.mydogtom.persistence.UserName
5 | import com.github.mydogtom.persistence.UserRepository
6 | import javax.inject.Inject
7 |
8 | @FeatureScope
9 | class UserDetailsPresenter @Inject constructor(private val userName: UserName,
10 | private val view: UserDetailsView,
11 | private val userRepository: UserRepository) {
12 | init {
13 | view.showData(userName)
14 | view.showAddress(userRepository.getAddress())
15 | }
16 |
17 | fun save(address: String) {
18 | userRepository.setAddress(address)
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/login/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 |
--------------------------------------------------------------------------------
/base-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 |
--------------------------------------------------------------------------------
/persistence/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 |
--------------------------------------------------------------------------------
/user-details/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 |
--------------------------------------------------------------------------------
/login-navigator/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 |
--------------------------------------------------------------------------------
/user-details-navigator/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/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/mydogtom/multimoduleexample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.multimoduleexample
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import android.widget.Toast
6 | import butterknife.ButterKnife
7 | import butterknife.OnClick
8 | import com.github.mydogtom.login.navigator.LoginNavigator
9 | import javax.inject.Inject
10 |
11 | class MainActivity : AppCompatActivity() {
12 | @Inject lateinit var loginNavigator: LoginNavigator
13 |
14 | override fun onCreate(savedInstanceState: Bundle?) {
15 | super.onCreate(savedInstanceState)
16 | setContentView(R.layout.activity_main)
17 | ButterKnife.bind(this)
18 | DaggerMainActivityComponent.builder().build().inject(this)
19 | }
20 |
21 |
22 | @OnClick(R.id.buttonStart)
23 | fun onStartClick() {
24 | Toast.makeText(this, "start activity", Toast.LENGTH_SHORT).show()
25 | loginNavigator.openLogin(this)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/dependencies.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | versions = [
3 | compileSdk : 26,
4 | buildToolsVersion : "26.0.2",
5 | minSdk : 19,
6 | targetSdk : 26,
7 | butterknifeVersion: '8.8.1',
8 | daggerVersion : '2.11',
9 | supportLib : '26.1.0',
10 | constraintLayout : '1.0.2'
11 | ]
12 | libraries = [
13 | butterknife : "com.jakewharton:butterknife:$versions.butterknifeVersion",
14 | butterknifeCompiler: "com.jakewharton:butterknife-compiler:$versions.butterknifeVersion",
15 | dagger : "com.google.dagger:dagger:$versions.daggerVersion",
16 | daggerCompiler : "com.google.dagger:dagger-compiler:$versions.daggerVersion",
17 | appcompatV7 : "com.android.support:appcompat-v7:$versions.supportLib",
18 | constraintLayout : "com.android.support.constraint:constraint-layout:$versions.constraintLayout"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/mydogtom/multimoduleexample/App.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.multimoduleexample
2 |
3 | import android.app.Application
4 | import com.github.mydogtom.baseapp.DaggerLoggedOutComponent
5 | import com.github.mydogtom.baseapp.LoggedInComponent
6 | import com.github.mydogtom.baseapp.LoggedInComponentProvider
7 | import com.github.mydogtom.baseapp.LoggedOutComponent
8 | import com.github.mydogtom.baseapp.LoggedOutComponentProvider
9 |
10 | class App : Application(), LoggedOutComponentProvider, LoggedInComponentProvider {
11 | private val loggedOutComponent: LoggedOutComponent by lazy {
12 | DaggerLoggedOutComponent.builder()
13 | .build()
14 | }
15 |
16 | private val loggedInComponent: LoggedInComponent by lazy {
17 | loggedOutComponent.loggedInComponentBuilder()
18 | .build()
19 | }
20 |
21 | override fun provideLoggedOutComponent(): LoggedOutComponent = loggedOutComponent
22 |
23 | override fun provideLoggedInComponent(): LoggedInComponent = loggedInComponent
24 | }
25 |
--------------------------------------------------------------------------------
/login/src/main/java/com/github/mydogtom/login/LoginComponent.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.login
2 |
3 | import com.github.mydogtom.baseapp.FeatureScope
4 | import com.github.mydogtom.baseapp.LoggedOutComponent
5 | import com.github.mydogtom.persistence.UserRepository
6 | import dagger.BindsInstance
7 | import dagger.Component
8 | import dagger.Module
9 | import dagger.Provides
10 |
11 | @Component(
12 | modules = arrayOf(LoginModule::class),
13 | dependencies = arrayOf(LoggedOutComponent::class))
14 | @FeatureScope
15 | interface LoginComponent {
16 | fun inject(activity: LogInActivity)
17 |
18 | @Component.Builder
19 | interface Builder {
20 | @BindsInstance fun loginView(view: LogInView): Builder
21 | fun loggedOutComponent(component: LoggedOutComponent): Builder
22 | fun build(): LoginComponent
23 | }
24 | }
25 |
26 | @Module
27 | class LoginModule {
28 | @Provides
29 | fun provideLoginPresenter(repository: UserRepository, view: LogInView)
30 | = LoginPresenter(repository, view)
31 | }
32 |
--------------------------------------------------------------------------------
/base-app/src/main/java/com/github/mydogtom/baseapp/LoggedInComponent.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.baseapp
2 |
3 | import android.content.Context
4 | import com.github.mydogtom.persistence.UserName
5 | import com.github.mydogtom.persistence.UserRepository
6 | import dagger.Module
7 | import dagger.Provides
8 | import dagger.Subcomponent
9 |
10 | @LoggedInScope
11 | @Subcomponent(modules = arrayOf(LoggedInModule::class))
12 | interface LoggedInComponent {
13 |
14 | fun provideUser(): UserName
15 |
16 | fun provideUserRepository(): UserRepository
17 |
18 | @Subcomponent.Builder
19 | interface Builder {
20 | fun build(): LoggedInComponent
21 | }
22 | }
23 |
24 | @Module
25 | class LoggedInModule {
26 | @LoggedInScope
27 | @Provides
28 | fun provideUser(userRepository: UserRepository) = userRepository.getUserName()
29 | }
30 |
31 |
32 | interface LoggedInComponentProvider {
33 | fun provideLoggedInComponent(): LoggedInComponent
34 | }
35 |
36 | @Suppress("UnsafeCast")
37 | fun Context.loggedInComponent() =
38 | (this.applicationContext as LoggedInComponentProvider).provideLoggedInComponent()
39 |
--------------------------------------------------------------------------------
/base-app/src/main/java/com/github/mydogtom/baseapp/LoggedOutComponent.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.baseapp
2 |
3 | import android.content.Context
4 | import com.github.mydogtom.persistence.Storage
5 | import com.github.mydogtom.persistence.UserRepository
6 | import dagger.Component
7 | import dagger.Module
8 | import dagger.Provides
9 | import javax.inject.Singleton
10 |
11 | @Singleton
12 | @Component(modules = arrayOf(PersistenceModule::class, SubComponentsBindigsModule::class))
13 | interface LoggedOutComponent {
14 | fun userRepository(): UserRepository
15 |
16 | fun loggedInComponentBuilder(): LoggedInComponent.Builder
17 | }
18 |
19 | @Module
20 | class PersistenceModule {
21 | @Provides
22 | @Singleton
23 | fun provideStorage(): Storage = Storage()
24 |
25 | @Provides
26 | @Singleton
27 | fun provideUserRepository(storage: Storage): UserRepository = UserRepository(storage)
28 | }
29 |
30 |
31 | interface LoggedOutComponentProvider {
32 | fun provideLoggedOutComponent(): LoggedOutComponent
33 | }
34 |
35 | @Suppress("UnsafeCast")
36 | fun Context.loggedOutComponent() =
37 | (this.applicationContext as LoggedOutComponentProvider).provideLoggedOutComponent()
38 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/persistence/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply from: '../dependencies.gradle'
4 |
5 | android {
6 | compileSdkVersion versions.compileSdk
7 | buildToolsVersion versions.buildToolsVersion
8 |
9 |
10 | defaultConfig {
11 | minSdkVersion versions.minSdk
12 | targetSdkVersion versions.targetSdk
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | }
28 |
29 | dependencies {
30 | compile fileTree(dir: 'libs', include: ['*.jar'])
31 | compile libraries.appcompatV7
32 | testCompile 'junit:junit:4.12'
33 | androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1', {
34 | exclude group: 'com.android.support', module: 'support-annotations'
35 | })
36 | compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
37 |
38 | }
39 | repositories {
40 | mavenCentral()
41 | }
42 |
--------------------------------------------------------------------------------
/base-app/build.gradle:
--------------------------------------------------------------------------------
1 | apply from: '../dependencies.gradle'
2 | apply plugin: 'com.android.library'
3 | apply plugin: 'kotlin-android'
4 | apply plugin: 'kotlin-kapt'
5 |
6 | android {
7 | compileSdkVersion versions.compileSdk
8 | buildToolsVersion versions.buildToolsVersion
9 |
10 | defaultConfig {
11 | minSdkVersion versions.minSdk
12 | targetSdkVersion versions.targetSdk
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | }
28 |
29 | dependencies {
30 | compile fileTree(dir: 'libs', include: ['*.jar'])
31 | compile libraries.appcompatV7
32 | compile project(":persistence")
33 | testCompile 'junit:junit:4.12'
34 | androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1', {
35 | exclude group: 'com.android.support', module: 'support-annotations'
36 | })
37 | compile libraries.dagger
38 | kapt libraries.daggerCompiler
39 | }
40 |
--------------------------------------------------------------------------------
/user-details-navigator/build.gradle:
--------------------------------------------------------------------------------
1 | apply from: '../dependencies.gradle'
2 | apply plugin: 'com.android.library'
3 | apply plugin: 'kotlin-android'
4 | apply plugin: 'kotlin-kapt'
5 |
6 | android {
7 | compileSdkVersion versions.compileSdk
8 | buildToolsVersion versions.buildToolsVersion
9 |
10 | defaultConfig {
11 | minSdkVersion versions.minSdk
12 | targetSdkVersion versions.targetSdk
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | compile fileTree(dir: 'libs', include: ['*.jar'])
29 | compile libraries.appcompatV7
30 | testCompile 'junit:junit:4.12'
31 | androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1', {
32 | exclude group: 'com.android.support', module: 'support-annotations'
33 | })
34 | compile libraries.dagger
35 | kapt libraries.daggerCompiler
36 | compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
37 | }
38 | repositories {
39 | mavenCentral()
40 | }
41 |
--------------------------------------------------------------------------------
/login-navigator/build.gradle:
--------------------------------------------------------------------------------
1 | apply from: '../dependencies.gradle'
2 | apply plugin: 'com.android.library'
3 | apply plugin: 'kotlin-android'
4 | apply plugin: 'kotlin-kapt'
5 |
6 | android {
7 | compileSdkVersion versions.compileSdk
8 | buildToolsVersion versions.buildToolsVersion
9 |
10 | defaultConfig {
11 | minSdkVersion versions.minSdk
12 | targetSdkVersion versions.targetSdk
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | }
28 |
29 | dependencies {
30 | compile fileTree(dir: 'libs', include: ['*.jar'])
31 | compile libraries.appcompatV7
32 | testCompile 'junit:junit:4.12'
33 | androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1', {
34 | exclude group: 'com.android.support', module: 'support-annotations'
35 | })
36 | compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
37 |
38 | compile libraries.dagger
39 | kapt libraries.daggerCompiler
40 | }
41 | repositories {
42 | mavenCentral()
43 | }
44 |
--------------------------------------------------------------------------------
/user-details/build.gradle:
--------------------------------------------------------------------------------
1 | apply from: '../dependencies.gradle'
2 | apply plugin: 'com.android.library'
3 | apply plugin: 'kotlin-android'
4 | apply plugin: 'kotlin-kapt'
5 |
6 | android {
7 | compileSdkVersion versions.compileSdk
8 | buildToolsVersion versions.buildToolsVersion
9 |
10 | defaultConfig {
11 | minSdkVersion versions.minSdk
12 | targetSdkVersion versions.targetSdk
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | }
28 |
29 | dependencies {
30 | compile project(":base-app")
31 | compile project(":user-details-navigator")
32 | compile fileTree(dir: 'libs', include: ['*.jar'])
33 | compile libraries.appcompatV7
34 | compile libraries.constraintLayout
35 | testCompile 'junit:junit:4.12'
36 | androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1', {
37 | exclude group: 'com.android.support', module: 'support-annotations'
38 | })
39 | compile libraries.dagger
40 | kapt libraries.daggerCompiler
41 | compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
42 | }
43 |
44 | apply plugin: 'kotlin-android-extensions'
--------------------------------------------------------------------------------
/login/src/main/java/com/github/mydogtom/login/LogInActivity.kt:
--------------------------------------------------------------------------------
1 | package com.github.mydogtom.login
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import android.widget.Button
6 | import android.widget.EditText
7 | import com.github.mydogtom.baseapp.loggedOutComponent
8 | import com.github.mydogtom.userdetailsnavigator.UserDetailsNavigator
9 | import javax.inject.Inject
10 |
11 | class LogInActivity : AppCompatActivity(), LogInView {
12 | @Inject lateinit var presenter: LoginPresenter
13 | @Inject lateinit var userDetailsNavigator: UserDetailsNavigator
14 | private val logInButton by lazy {
15 | findViewById