├── .gitignore ├── .idea ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── account ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── app │ │ └── account │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── app │ │ │ └── account │ │ │ ├── LoginFragment.kt │ │ │ └── WelcomeFragment.kt │ └── res │ │ ├── layout │ │ ├── fragment_login.xml │ │ ├── fragment_welcome.xml │ │ └── login.xml │ │ ├── navigation │ │ └── navigation_login.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── app │ └── account │ └── ExampleUnitTest.java ├── albums ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── app │ │ └── albums │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── app │ │ │ └── albums │ │ │ ├── base │ │ │ └── AlbumsFragmentBuilder.kt │ │ │ └── ui │ │ │ ├── AlbumsFragment.kt │ │ │ ├── AlbumsRVAdapter.kt │ │ │ └── AlbumsViewModel.kt │ └── res │ │ ├── layout │ │ ├── fragment_albums.xml │ │ └── item_album.xml │ │ ├── navigation │ │ └── navigation_albums.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── app │ └── albums │ └── ExampleUnitTest.java ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── app │ │ └── modular │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── app │ │ │ └── modular │ │ │ ├── base │ │ │ ├── AppComponent.kt │ │ │ ├── AppModule.kt │ │ │ ├── MainActivityComponent.kt │ │ │ ├── MyApplication.kt │ │ │ └── builder │ │ │ │ ├── ActivityBuilder.kt │ │ │ │ ├── AlbumsViewModelBuilder.kt │ │ │ │ ├── PhotosViewModelBuilder.kt │ │ │ │ ├── ViewModelKey.kt │ │ │ │ └── viewmodel │ │ │ │ ├── ViewModelBuilder.kt │ │ │ │ └── ViewModelFactory.kt │ │ │ └── main │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_login.xml │ │ └── 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 │ │ ├── navigation │ │ └── navigation_main.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── app │ └── modular │ └── ExampleUnitTest.kt ├── build.gradle ├── datasource ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── app │ │ └── network │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── app │ │ │ └── network │ │ │ ├── NetworkClient.kt │ │ │ ├── NetworkModule.kt │ │ │ ├── api │ │ │ ├── AlbumsApi.kt │ │ │ └── PhotosApi.kt │ │ │ ├── cache │ │ │ ├── CacheInterface.kt │ │ │ ├── Listener.kt │ │ │ ├── MainDatabase.kt │ │ │ ├── albums │ │ │ │ ├── Album.kt │ │ │ │ ├── AlbumDao.kt │ │ │ │ └── AlbumPersist.kt │ │ │ └── photos │ │ │ │ ├── Photo.kt │ │ │ │ ├── PhotoDao.kt │ │ │ │ └── PhotoPersist.kt │ │ │ └── datasource │ │ │ ├── AlbumsDataSource.kt │ │ │ └── PhotosDataSource.kt │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── app │ └── network │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── photos ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── app │ │ └── photos │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── app │ │ │ └── photos │ │ │ ├── base │ │ │ └── PhotosFragmentBuilder.kt │ │ │ └── ui │ │ │ └── photos │ │ │ ├── PhotosFragment.kt │ │ │ ├── PhotosRVAdapter.kt │ │ │ └── PhotosViewModel.kt │ └── res │ │ ├── layout │ │ ├── fragment_photos.xml │ │ └── item_photo.xml │ │ ├── navigation │ │ └── navigation_photos.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── app │ └── photos │ └── ExampleUnitTest.java └── 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 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Modular-App-with-Android-Architecture-Components 2 | You can check the related article here :) 3 | 4 | https://medium.com/@alireza.rafeezadeh/modularization-by-feature-and-layer-with-android-architecture-components-80bf317d737 5 | 6 | -------------------------------------------------------------------------------- /account/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /account/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android-extensions' 3 | apply plugin: 'kotlin-android' 4 | 5 | 6 | 7 | android { 8 | compileSdkVersion 28 9 | 10 | 11 | defaultConfig { 12 | minSdkVersion 19 13 | targetSdkVersion 28 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | compileOptions { 28 | sourceCompatibility = '1.8' 29 | targetCompatibility = '1.8' 30 | } 31 | 32 | } 33 | 34 | dependencies { 35 | implementation fileTree(dir: 'libs', include: ['*.jar']) 36 | 37 | implementation 'androidx.appcompat:appcompat:1.0.2' 38 | testImplementation 'junit:junit:4.12' 39 | androidTestImplementation 'androidx.test:runner:1.1.1' 40 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 41 | 42 | implementation "androidx.core:core-ktx:$coreKTXVersion" 43 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 44 | 45 | // def nav_version = "2.1.0-alpha03" 46 | implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" 47 | implementation "androidx.navigation:navigation-fragment:$navigationVersion" // For Kotlin use navigation-fragment-ktx 48 | implementation "androidx.navigation:navigation-ui:$navigationVersion" // For Kotlin use navigation-ui-ktx 49 | 50 | 51 | } 52 | 53 | repositories { 54 | mavenCentral() 55 | } 56 | -------------------------------------------------------------------------------- /account/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 | -------------------------------------------------------------------------------- /account/src/androidTest/java/com/app/account/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.app.account; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.firstnavigation.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /account/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /account/src/main/java/com/app/account/LoginFragment.kt: -------------------------------------------------------------------------------- 1 | package com.app.account 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.core.net.toUri 8 | import androidx.fragment.app.Fragment 9 | import androidx.navigation.Navigation.findNavController 10 | import kotlinx.android.synthetic.main.fragment_login.* 11 | 12 | 13 | /** 14 | * Created by Alireza Rafeezadeh on 5/15/2019. 15 | */ 16 | 17 | class LoginFragment : Fragment() { 18 | 19 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 20 | return inflater.inflate(R.layout.fragment_login,container,false) 21 | } 22 | 23 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 24 | super.onViewCreated(view, savedInstanceState) 25 | 26 | actionButton.setOnClickListener { 27 | val moviesURI = "albums://album".toUri() 28 | findNavController(it).navigate(moviesURI) 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /account/src/main/java/com/app/account/WelcomeFragment.kt: -------------------------------------------------------------------------------- 1 | package com.app.account 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import androidx.navigation.Navigation.findNavController 9 | import kotlinx.android.synthetic.main.fragment_welcome.* 10 | 11 | /** 12 | * Created by Alireza Rafeezadeh on 5/15/2019. 13 | */ 14 | class WelcomeFragment : Fragment() { 15 | 16 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 17 | return inflater.inflate(R.layout.fragment_welcome,container,false) 18 | } 19 | 20 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 21 | super.onViewCreated(view, savedInstanceState) 22 | 23 | actionButton.setOnClickListener { 24 | findNavController(it).navigate(R.id.action_welcomeFragment_to_loginFragment) 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /account/src/main/res/layout/fragment_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 16 | 24 |