├── .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 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
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 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
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 |
35 |
46 |
--------------------------------------------------------------------------------
/account/src/main/res/layout/fragment_welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
18 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/account/src/main/res/layout/login.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
19 |
--------------------------------------------------------------------------------
/account/src/main/res/navigation/navigation_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
12 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/account/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FirstNavigation
3 |
4 |
--------------------------------------------------------------------------------
/account/src/test/java/com/app/account/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.app.account;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/albums/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/albums/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android-extensions'
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-kapt'
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 | api project(':datasource')
38 |
39 |
40 | implementation 'androidx.appcompat:appcompat:1.0.2'
41 | testImplementation 'junit:junit:4.12'
42 | androidTestImplementation 'androidx.test:runner:1.1.1'
43 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
44 |
45 | implementation "androidx.core:core-ktx:$coreKTXVersion"
46 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
47 |
48 | implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
49 | implementation "androidx.navigation:navigation-fragment:$navigationVersion" // For Kotlin use navigation-fragment-ktx
50 | implementation "androidx.navigation:navigation-ui:$navigationVersion" // For Kotlin use navigation-ui-ktx
51 |
52 |
53 |
54 | // ViewModel and LiveData
55 | implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
56 | implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
57 |
58 | // alternately - if using Java8, use the following instead of lifecycle-compiler
59 | implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
60 | implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha01"
61 |
62 |
63 | // dagger
64 | implementation "com.google.dagger:dagger:$daggerVersion"
65 | kapt "com.google.dagger:dagger-compiler:$daggerVersion"
66 | // dagger android
67 | implementation "com.google.dagger:dagger-android:$daggerVersion"
68 | implementation "com.google.dagger:dagger-android-support:$daggerVersion" // if you use the support libraries
69 | kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
70 |
71 | }
72 | repositories {
73 | mavenCentral()
74 | }
75 |
--------------------------------------------------------------------------------
/albums/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 |
--------------------------------------------------------------------------------
/albums/src/androidTest/java/com/app/albums/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.app.albums;
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.movie.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/albums/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/albums/src/main/java/com/app/albums/base/AlbumsFragmentBuilder.kt:
--------------------------------------------------------------------------------
1 | package com.app.albums.base
2 |
3 | import com.app.albums.ui.AlbumsFragment
4 | import dagger.Module
5 | import dagger.android.ContributesAndroidInjector
6 |
7 | /**
8 | * Created by Alireza Rafeezadeh on 6/18/2019.
9 | */
10 |
11 | @Module
12 | abstract class AlbumsFragmentBuilder {
13 |
14 | @ContributesAndroidInjector
15 | internal abstract fun bindMoviesListFragment(): AlbumsFragment
16 |
17 | }
--------------------------------------------------------------------------------
/albums/src/main/java/com/app/albums/ui/AlbumsFragment.kt:
--------------------------------------------------------------------------------
1 | package com.app.albums.ui
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.lifecycle.Observer
8 | import androidx.lifecycle.ViewModelProvider
9 | import androidx.lifecycle.ViewModelProviders
10 | import androidx.recyclerview.widget.LinearLayoutManager
11 | import androidx.recyclerview.widget.RecyclerView
12 | import com.app.albums.R
13 | import com.app.network.cache.albums.Album
14 | import dagger.android.support.DaggerFragment
15 | import kotlinx.android.synthetic.main.fragment_albums.*
16 | import javax.inject.Inject
17 |
18 | /**
19 | * Created by Alireza Rafeezadeh on 5/15/2019.
20 | */
21 | class AlbumsFragment : DaggerFragment() {
22 |
23 |
24 | lateinit var adapter: AlbumsRVAdapter
25 |
26 | private lateinit var albumsViewModel: AlbumsViewModel
27 |
28 | @Inject
29 | lateinit var viewModelFactory: ViewModelProvider.Factory
30 |
31 |
32 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
33 | return inflater.inflate(R.layout.fragment_albums, container, false)
34 | }
35 |
36 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
37 | super.onViewCreated(view, savedInstanceState)
38 |
39 | initViewModel()
40 | initObservers()
41 | getData()
42 |
43 | }
44 |
45 |
46 | private fun getData() {
47 | albumsViewModel.getAlbums().observe(this, Observer {
48 | initRecyclerView(it)
49 | })
50 | }
51 |
52 |
53 | private fun initViewModel() {
54 | albumsViewModel = ViewModelProviders.of(this, viewModelFactory)[AlbumsViewModel::class.java]
55 | }
56 |
57 |
58 |
59 | private fun initObservers() {
60 |
61 | albumsViewModel.albumsLiveData.observe(this, Observer {
62 | if (it.isNotEmpty())
63 | initRecyclerView(it)
64 | })
65 |
66 | }
67 |
68 | private fun initRecyclerView(albums: List) {
69 | adapter = AlbumsRVAdapter(albums)
70 | val layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false)
71 | albumsRecyclerView.layoutManager = layoutManager
72 | albumsRecyclerView.adapter = adapter
73 | }
74 | }
--------------------------------------------------------------------------------
/albums/src/main/java/com/app/albums/ui/AlbumsRVAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.app.albums.ui
2 |
3 | import android.view.LayoutInflater
4 | import android.view.View
5 | import android.view.ViewGroup
6 | import android.widget.TextView
7 | import androidx.constraintlayout.widget.ConstraintLayout
8 | import androidx.core.net.toUri
9 | import androidx.navigation.Navigation.findNavController
10 | import androidx.recyclerview.widget.RecyclerView
11 | import com.app.albums.R
12 | import com.app.network.cache.albums.Album
13 |
14 | /**
15 | * Created by Alireza Rafeezadeh on 7/8/2019.
16 | */
17 | class AlbumsRVAdapter(val albums: List) :
18 | RecyclerView.Adapter() {
19 |
20 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
21 | val view = LayoutInflater.from(parent.context).inflate(R.layout.item_album, parent, false)
22 | return ItemViewHolder(view)
23 | }
24 |
25 | override fun getItemCount(): Int {
26 | return albums.size
27 | }
28 |
29 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
30 | (holder as ItemViewHolder).userIdTextView.text = albums[position].userId.toString()
31 | holder.titleTextView.text = albums[position].title
32 |
33 | holder.rootLayout.setOnClickListener {
34 | val moviesURI = "photos://photo".toUri()
35 | findNavController(holder.rootLayout).navigate(moviesURI)
36 | }
37 | }
38 |
39 | class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
40 |
41 | val titleTextView: TextView = itemView.findViewById(R.id.titleTextView)
42 | val userIdTextView: TextView = itemView.findViewById(R.id.userIdTextView)
43 | val rootLayout: ConstraintLayout = itemView.findViewById(R.id.albumRootLayout)
44 | }
45 | }
--------------------------------------------------------------------------------
/albums/src/main/java/com/app/albums/ui/AlbumsViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.app.albums.ui
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.lifecycle.MutableLiveData
5 | import androidx.lifecycle.ViewModel
6 | import com.app.network.datasource.AlbumsDataSource
7 | import com.app.network.cache.Listener
8 | import com.app.network.cache.albums.Album
9 | import javax.inject.Inject
10 |
11 | class AlbumsViewModel @Inject constructor(val albumsDataSource: AlbumsDataSource) : ViewModel() {
12 |
13 |
14 | var albumsLiveData : MutableLiveData> = MutableLiveData()
15 |
16 |
17 | fun getAlbums(): LiveData> {
18 |
19 | return albumsDataSource.getAlbums(object :
20 | Listener> {
21 | override fun onResponse(response: List) {
22 | albumsLiveData.postValue(response)
23 | }
24 | })
25 |
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/albums/src/main/res/layout/fragment_albums.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/albums/src/main/res/layout/item_album.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
28 |
29 |
--------------------------------------------------------------------------------
/albums/src/main/res/navigation/navigation_albums.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/albums/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | movie
3 | albums://album
4 |
5 |
--------------------------------------------------------------------------------
/albums/src/test/java/com/app/albums/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.app.albums;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 |
8 | /**
9 | * this is for generating dagger classes https://antonioleiva.com/dagger-android-kotlin/
10 | * look for a better solution
11 | */
12 |
13 |
14 | android {
15 | compileSdkVersion 28
16 | defaultConfig {
17 | applicationId "com.app.modular"
18 | minSdkVersion 19
19 | targetSdkVersion 28
20 | versionCode 1
21 | versionName "1.0"
22 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23 | }
24 | buildTypes {
25 | release {
26 | minifyEnabled false
27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | compileOptions {
31 | sourceCompatibility = '1.8'
32 | targetCompatibility = '1.8'
33 | }
34 | }
35 |
36 | apply plugin: 'kotlin-kapt'
37 |
38 |
39 | dependencies {
40 | implementation fileTree(dir: 'libs', include: ['*.jar'])
41 |
42 | implementation project(':account')
43 | implementation project(':albums')
44 | implementation project(':photos')
45 | implementation project(':datasource')
46 |
47 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
48 | implementation 'androidx.appcompat:appcompat:1.0.2'
49 | implementation 'androidx.core:core-ktx:1.0.2'
50 | implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
51 | testImplementation 'junit:junit:4.12'
52 |
53 | androidTestImplementation 'androidx.test:runner:1.1.1'
54 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
55 | // implementation 'android.arch.navigation:navigation-fragment:1.0.0'
56 | // implementation 'android.arch.navigation:navigation-ui:1.0.0'
57 |
58 | implementation "androidx.navigation:navigation-fragment:$navigationVersion" // For Kotlin use navigation-fragment-ktx
59 | implementation "androidx.navigation:navigation-ui:$navigationVersion" // For Kotlin use navigation-ui-ktx
60 |
61 |
62 | implementation 'org.koin:koin-android:2.0.0-GA4'
63 |
64 |
65 |
66 |
67 | // dagger
68 | implementation "com.google.dagger:dagger:$daggerVersion"
69 | kapt "com.google.dagger:dagger-compiler:$daggerVersion"
70 | // dagger android
71 | implementation "com.google.dagger:dagger-android:$daggerVersion"
72 | implementation "com.google.dagger:dagger-android-support:$daggerVersion" // if you use the support libraries
73 | kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
74 |
75 |
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/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/app/modular/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular
2 |
3 | import androidx.test.InstrumentationRegistry
4 | import androidx.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.example.myapplication", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/AppComponent.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base
2 |
3 |
4 | import android.app.Application
5 | import com.app.modular.base.builder.ActivityBuilder
6 | import com.app.modular.base.builder.viewmodel.ViewModelBuilder
7 | import com.app.network.NetworkModule
8 | import dagger.BindsInstance
9 | import dagger.Component
10 | import dagger.android.AndroidInjector
11 | import dagger.android.DaggerApplication
12 | import dagger.android.support.AndroidSupportInjectionModule
13 | import javax.inject.Singleton
14 |
15 | /**
16 | * Created by alirezarafeezadeh on 2019-06-01.
17 | */
18 |
19 |
20 | @Singleton
21 | @Component(
22 | modules = [AndroidSupportInjectionModule::class,
23 | AppModule::class,
24 | ViewModelBuilder::class,
25 | ActivityBuilder::class,
26 | NetworkModule::class
27 | ]
28 | )
29 | interface AppComponent : AndroidInjector {
30 |
31 | fun inject(app: MyApplication)
32 |
33 | override fun inject(instance: DaggerApplication)
34 |
35 | @Component.Builder
36 | interface Builder {
37 |
38 | @BindsInstance
39 | fun application(application: Application): Builder
40 |
41 | fun build(): AppComponent
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/AppModule.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base
2 |
3 | import android.app.Application
4 | import android.content.Context
5 | import dagger.Module
6 | import dagger.Provides
7 | import javax.inject.Singleton
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 6/1/2019.
11 | */
12 |
13 |
14 | @Module(subcomponents = [MainActivityComponent::class])
15 | class AppModule {
16 |
17 | @Provides
18 | @Singleton
19 | internal fun provideContext(application: Application): Context {
20 | return application
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/MainActivityComponent.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base
2 |
3 |
4 | import com.app.modular.main.MainActivity
5 | import dagger.Subcomponent
6 | import dagger.android.AndroidInjector
7 |
8 | /**
9 | * Created by Alireza Rafeezadeh on 5/20/2019.
10 | */
11 |
12 | @Subcomponent
13 | interface MainActivityComponent : AndroidInjector {
14 |
15 | @Subcomponent.Builder
16 | abstract class Builder : AndroidInjector.Builder()
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/MyApplication.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base
2 |
3 | import dagger.android.AndroidInjector
4 | import dagger.android.DaggerApplication
5 |
6 |
7 | class MyApplication : DaggerApplication() {
8 |
9 | override fun applicationInjector(): AndroidInjector {
10 | val appComponent = DaggerAppComponent.builder().application(this).build()
11 | appComponent.inject(this)
12 | return appComponent
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/builder/ActivityBuilder.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base.builder
2 |
3 | import com.app.albums.base.AlbumsFragmentBuilder
4 | import com.app.modular.main.MainActivity
5 | import com.app.photos.base.PhotosFragmentBuilder
6 | import dagger.Module
7 | import dagger.android.ContributesAndroidInjector
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 6/1/2019.
11 | */
12 |
13 | @Module
14 | abstract class ActivityBuilder {
15 |
16 | @ContributesAndroidInjector(
17 | modules = [
18 | AlbumsFragmentBuilder::class,
19 | PhotosFragmentBuilder::class,
20 | AlbumsViewModelBuilder::class,
21 | PhotosViewModelBuilder::class
22 | ]
23 | )
24 |
25 | internal abstract fun bindMainActivity(): MainActivity
26 |
27 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/builder/AlbumsViewModelBuilder.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base.builder
2 |
3 | import androidx.lifecycle.ViewModel
4 | import com.app.albums.ui.AlbumsViewModel
5 | import dagger.Binds
6 | import dagger.Module
7 | import dagger.multibindings.IntoMap
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 7/8/2019.
11 | */
12 | @Module
13 | abstract class AlbumsViewModelBuilder {
14 |
15 | @Binds
16 | @IntoMap
17 | @ViewModelKey(AlbumsViewModel::class)
18 | internal abstract fun bindHomeViewModel(viewModel: AlbumsViewModel): ViewModel
19 |
20 |
21 |
22 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/builder/PhotosViewModelBuilder.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base.builder
2 |
3 | import androidx.lifecycle.ViewModel
4 | import com.app.photos.ui.photos.PhotosViewModel
5 | import dagger.Binds
6 | import dagger.Module
7 | import dagger.multibindings.IntoMap
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 7/8/2019.
11 | */
12 | @Module
13 | abstract class PhotosViewModelBuilder {
14 |
15 | @Binds
16 | @IntoMap
17 | @ViewModelKey(PhotosViewModel::class)
18 | internal abstract fun bindHomeViewModel(viewModel: PhotosViewModel): ViewModel
19 |
20 |
21 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/builder/ViewModelKey.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base.builder
2 |
3 | import androidx.lifecycle.ViewModel
4 | import dagger.MapKey
5 | import kotlin.reflect.KClass
6 |
7 | /**
8 | * Created by Alireza Rafeezadeh on 7/8/2019.
9 | */
10 |
11 | @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
12 | @kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
13 | @MapKey
14 | annotation class ViewModelKey(val value: KClass)
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/builder/viewmodel/ViewModelBuilder.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018.
3 | * All rights reserved for Pipedrive
4 | */
5 |
6 | package com.app.modular.base.builder.viewmodel
7 |
8 | import androidx.lifecycle.ViewModelProvider
9 | import dagger.Binds
10 | import dagger.Module
11 |
12 | @Module
13 | abstract class ViewModelBuilder {
14 |
15 | @Binds
16 | internal abstract fun bindViewModelFactory(factory: ViewModelFactory): ViewModelProvider.Factory
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/base/builder/viewmodel/ViewModelFactory.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.base.builder.viewmodel
2 |
3 | import androidx.lifecycle.ViewModel
4 | import androidx.lifecycle.ViewModelProvider
5 | import javax.inject.Inject
6 | import javax.inject.Provider
7 |
8 | /**
9 | * Created by Alireza Rafeezadeh on 7/8/2019.
10 | */
11 | @Suppress("UNCHECKED_CAST")
12 | class ViewModelFactory @Inject constructor(private val viewModelsMap: Map, @JvmSuppressWildcards Provider>) :
13 | ViewModelProvider.Factory {
14 |
15 | override fun create(modelClass: Class): T {
16 | val creator = viewModelsMap[modelClass] ?:
17 | viewModelsMap.asIterable().firstOrNull {
18 | modelClass.isAssignableFrom(it.key)
19 | }?.value ?: throw IllegalArgumentException("unknown model class $modelClass")
20 | return try {
21 | creator.get() as T
22 | } catch (e: Exception) {
23 | throw RuntimeException(e)
24 | }
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/modular/main/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular.main
2 |
3 | import android.os.Bundle
4 | import com.app.modular.R
5 | import dagger.android.support.DaggerAppCompatActivity
6 | import retrofit2.Retrofit
7 |
8 | class MainActivity : DaggerAppCompatActivity() {
9 |
10 | override fun onCreate(savedInstanceState: Bundle?) {
11 | super.onCreate(savedInstanceState)
12 | setContentView(R.layout.activity_main)
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/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_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/navigation/navigation_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Modular With Navigation
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/app/modular/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.app.modular
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | ext {
6 | kotlin_version = '1.3.31'
7 | coreKTXVersion = "1.0.2"
8 | daggerVersion = '2.22.1'
9 | constraintLayoutVersion = '1.1.3'
10 | navigationVersion = "2.1.0-alpha03"
11 | koin_version = "2.0.0-GA2"
12 | retrofitVersion = "2.5.0"
13 | moshiKotlinVersion = "1.8.0"
14 | rxAndroidVersion = "2.1.1"
15 | rxJavaVersion = "2.2.8"
16 | rxRelayVersion = "2.1.0"
17 | lifecycle_version = "2.0.0"
18 | room_version = "2.1.0-rc01"
19 |
20 | }
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | dependencies {
27 | classpath 'com.android.tools.build:gradle:3.4.0'
28 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
29 | // NOTE: Do not place your application dependencies here; they belong
30 | // in the individual module build.gradle files
31 | }
32 | }
33 |
34 | allprojects {
35 | repositories {
36 | google()
37 | jcenter()
38 |
39 | }
40 | }
41 |
42 |
43 | task clean(type: Delete) {
44 | delete rootProject.buildDir
45 | }
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/datasource/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/datasource/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android-extensions'
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-kapt'
6 |
7 |
8 | android {
9 | compileSdkVersion 28
10 |
11 |
12 | defaultConfig {
13 | minSdkVersion 19
14 | targetSdkVersion 28
15 | versionCode 1
16 | versionName "1.0"
17 |
18 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
19 |
20 | }
21 |
22 | buildTypes {
23 | release {
24 | minifyEnabled false
25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26 | }
27 | }
28 | compileOptions {
29 | sourceCompatibility = '1.8'
30 | targetCompatibility = '1.8'
31 | }
32 |
33 |
34 | }
35 |
36 | dependencies {
37 | implementation fileTree(dir: 'libs', include: ['*.jar'])
38 |
39 | implementation 'androidx.appcompat:appcompat:1.0.2'
40 | testImplementation 'junit:junit:4.12'
41 | androidTestImplementation 'androidx.test:runner:1.1.1'
42 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
43 | implementation "androidx.core:core-ktx:$coreKTXVersion"
44 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
45 |
46 |
47 |
48 | api "com.squareup.retrofit2:retrofit:$retrofitVersion"
49 |
50 | api "com.squareup.retrofit2:converter-gson:$retrofitVersion"
51 | api "com.squareup.okhttp3:okhttp:3.14.2"
52 | api "com.squareup.okhttp3:logging-interceptor:3.14.2"
53 |
54 |
55 | // dagger
56 | implementation "com.google.dagger:dagger:$daggerVersion"
57 | kapt "com.google.dagger:dagger-compiler:$daggerVersion"
58 | // dagger android
59 | implementation "com.google.dagger:dagger-android:$daggerVersion"
60 | implementation "com.google.dagger:dagger-android-support:$daggerVersion" // if you use the support libraries
61 | kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
62 |
63 |
64 |
65 | implementation "androidx.room:room-runtime:$room_version"
66 | kapt "androidx.room:room-compiler:$room_version" // For Kotlin use kapt instead of annotationProcessor
67 |
68 |
69 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1"
70 |
71 | }
72 | repositories {
73 | mavenCentral()
74 | }
75 |
--------------------------------------------------------------------------------
/datasource/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 |
--------------------------------------------------------------------------------
/datasource/src/androidTest/java/com/app/network/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.app.network;
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.network.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/datasource/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/NetworkClient.kt:
--------------------------------------------------------------------------------
1 | package com.app.network
2 |
3 | import retrofit2.Retrofit
4 | import javax.inject.Inject
5 |
6 | /**
7 | * Created by Alireza Rafeezadeh on 6/12/2019.
8 | */
9 |
10 |
11 | class NetworkClient @Inject constructor(val retrofit: Retrofit) {
12 |
13 |
14 | fun getRetrofitService(interfaceTyoe : Class) : T {
15 | return retrofit.create(interfaceTyoe)
16 | }
17 |
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/NetworkModule.kt:
--------------------------------------------------------------------------------
1 | package com.app.network
2 |
3 | import com.app.network.api.AlbumsApi
4 | import dagger.Module
5 | import dagger.Provides
6 | import okhttp3.OkHttpClient
7 | import okhttp3.logging.HttpLoggingInterceptor
8 | import retrofit2.Retrofit
9 | import retrofit2.converter.gson.GsonConverterFactory
10 |
11 | /**
12 | * Created by Alireza Rafeezadeh on 6/1/2019.
13 | */
14 |
15 |
16 | @Module
17 | class NetworkModule {
18 |
19 | val httpLoggingInterceptor: HttpLoggingInterceptor
20 | @Provides
21 | get() {
22 | val httpLoggingInterceptor = HttpLoggingInterceptor()
23 | httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
24 | return httpLoggingInterceptor
25 | }
26 |
27 | @Provides
28 | fun getApiInterface(retroFit: Retrofit):
29 | AlbumsApi {
30 | return retroFit.create(AlbumsApi::class.java)
31 | }
32 |
33 |
34 | @Provides
35 | fun getRetrofit(okHttpClient: OkHttpClient):
36 | Retrofit {
37 | return Retrofit.Builder()
38 | .baseUrl("https://jsonplaceholder.typicode.com/")
39 | .addConverterFactory(GsonConverterFactory.create())
40 | .client(okHttpClient)
41 | .build()
42 | }
43 |
44 |
45 | @Provides
46 | fun getOkHttpCleint(httpLoggingInterceptor: HttpLoggingInterceptor):
47 | OkHttpClient {
48 | return OkHttpClient.Builder()
49 | .addInterceptor(httpLoggingInterceptor)
50 | .build()
51 | }
52 |
53 |
54 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/api/AlbumsApi.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.api
2 |
3 |
4 | import com.app.network.cache.albums.Album
5 | import retrofit2.Call
6 | import retrofit2.http.GET
7 |
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 5/15/2019.
11 | */
12 | interface AlbumsApi {
13 |
14 | @GET("albums")
15 | fun getAlbums(): Call>
16 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/api/PhotosApi.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.api
2 |
3 | import com.app.network.cache.photos.Photo
4 | import retrofit2.Call
5 | import retrofit2.http.GET
6 |
7 | /**
8 | * Created by Alireza Rafeezadeh on 7/8/2019.
9 | */
10 | interface PhotosApi {
11 |
12 | @GET("photos")
13 | fun getPhotos(): Call>
14 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/CacheInterface.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache
2 |
3 | import androidx.annotation.WorkerThread
4 | import androidx.lifecycle.LiveData
5 |
6 | /**
7 | * Created by Alireza Rafeezadeh on 6/15/2019.
8 | */
9 | interface CacheInterface {
10 |
11 |
12 | @WorkerThread
13 | suspend fun save(items : List)
14 |
15 | fun load() : LiveData>
16 |
17 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/Listener.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache
2 |
3 | /**
4 | * Created by Alireza Rafeezadeh on 6/15/2019.
5 | */
6 | interface Listener {
7 |
8 | fun onResponse(response : T)
9 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/MainDatabase.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache
2 |
3 | import android.content.Context
4 | import androidx.room.Database
5 | import androidx.room.Room
6 | import androidx.room.RoomDatabase
7 | import com.app.network.cache.albums.Album
8 | import com.app.network.cache.albums.AlbumDao
9 | import com.app.network.cache.photos.Photo
10 | import com.app.network.cache.photos.PhotoDao
11 |
12 |
13 | /**
14 | * Created by Alireza Rafeezadeh on 6/12/2019.
15 | */
16 |
17 |
18 | @Database(entities = [Album::class, Photo::class], version = 1)
19 | abstract class MainDatabase : RoomDatabase() {
20 |
21 |
22 | abstract fun postDao(): AlbumDao
23 |
24 | abstract fun photoDao(): PhotoDao
25 |
26 |
27 | companion object {
28 | @Volatile
29 | private var INSTANCE: MainDatabase? = null
30 |
31 | fun getDatabase(context: Context): MainDatabase {
32 | val tempInstance = INSTANCE
33 | if (tempInstance != null) {
34 | return tempInstance
35 | }
36 | synchronized(this) {
37 | val instance = Room.databaseBuilder(
38 | context.applicationContext,
39 | MainDatabase::class.java,
40 | "MainDatabase"
41 | ).build()
42 | INSTANCE = instance
43 | return instance
44 | }
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/albums/Album.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache.albums
2 |
3 | import androidx.annotation.NonNull
4 | import androidx.room.Entity
5 | import androidx.room.PrimaryKey
6 | import com.google.gson.annotations.Expose
7 | import com.google.gson.annotations.SerializedName
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 6/12/2019.
11 | */
12 |
13 | @Entity
14 | data class Album(
15 |
16 | @PrimaryKey
17 | @NonNull
18 | @SerializedName("id")
19 | @Expose
20 | val id: Int,
21 |
22 |
23 | @SerializedName("title")
24 | @Expose
25 | val title: String,
26 |
27 | @SerializedName("userId")
28 | @Expose
29 | val userId: Int
30 |
31 |
32 |
33 |
34 | )
35 |
36 |
37 |
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/albums/AlbumDao.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache.albums
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.room.Dao
5 | import androidx.room.Insert
6 | import androidx.room.OnConflictStrategy
7 | import androidx.room.Query
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 6/12/2019.
11 | */
12 |
13 | @Dao
14 | interface AlbumDao {
15 |
16 | @Insert(onConflict = OnConflictStrategy.REPLACE)
17 | fun save(albums: List)
18 |
19 | @Query("SELECT * FROM album")
20 | fun load(): LiveData>
21 |
22 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/albums/AlbumPersist.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache.albums
2 |
3 | import android.content.Context
4 | import androidx.annotation.WorkerThread
5 | import androidx.lifecycle.LiveData
6 | import com.app.network.cache.CacheInterface
7 | import com.app.network.cache.MainDatabase
8 | import javax.inject.Inject
9 |
10 | /**
11 | * Created by Alireza Rafeezadeh on 6/12/2019.
12 | */
13 | class AlbumPersist @Inject constructor(val context: Context) :
14 | CacheInterface {
15 |
16 | private var albumDao: AlbumDao = MainDatabase.getDatabase(context).postDao()
17 |
18 | @WorkerThread
19 | override suspend fun save(items: List) {
20 | albumDao.save(items)
21 | }
22 |
23 | override fun load(): LiveData> {
24 | return albumDao.load()
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/photos/Photo.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache.photos
2 |
3 | import androidx.annotation.NonNull
4 | import androidx.room.Entity
5 | import androidx.room.PrimaryKey
6 | import com.google.gson.annotations.Expose
7 | import com.google.gson.annotations.SerializedName
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 7/8/2019.
11 | */
12 |
13 | @Entity
14 | data class Photo(
15 |
16 |
17 | @PrimaryKey
18 | @NonNull
19 | @SerializedName("id")
20 | @Expose
21 | val id: Int,
22 |
23 |
24 | @SerializedName("albumId")
25 | @Expose
26 | val albumId: Int,
27 |
28 |
29 | @SerializedName("thumbnailUrl")
30 | @Expose
31 | val thumbnailUrl: String,
32 |
33 | @SerializedName("title")
34 | @Expose
35 | val title: String,
36 |
37 | @SerializedName("url")
38 | @Expose
39 | val url: String
40 | )
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/photos/PhotoDao.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache.photos
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.room.Dao
5 | import androidx.room.Insert
6 | import androidx.room.OnConflictStrategy
7 | import androidx.room.Query
8 |
9 | /**
10 | * Created by Alireza Rafeezadeh on 7/8/2019.
11 | */
12 | @Dao
13 | interface PhotoDao {
14 |
15 | @Insert(onConflict = OnConflictStrategy.REPLACE)
16 | fun save(posts: List)
17 |
18 | @Query("SELECT * FROM photo")
19 | fun load(): LiveData>
20 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/cache/photos/PhotoPersist.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.cache.photos
2 |
3 | import android.content.Context
4 | import androidx.annotation.WorkerThread
5 | import androidx.lifecycle.LiveData
6 | import com.app.network.cache.CacheInterface
7 | import com.app.network.cache.MainDatabase
8 | import javax.inject.Inject
9 |
10 | /**
11 | * Created by Alireza Rafeezadeh on 7/8/2019.
12 | */
13 | class PhotoPersist @Inject constructor(val context: Context) :
14 | CacheInterface {
15 |
16 | var photoDao: PhotoDao = MainDatabase.getDatabase(context).photoDao()
17 |
18 | @WorkerThread
19 | override suspend fun save(items: List) {
20 | photoDao.save(items)
21 | }
22 |
23 | override fun load(): LiveData> {
24 | return photoDao.load()
25 | }
26 |
27 |
28 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/datasource/AlbumsDataSource.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.datasource
2 |
3 | import android.util.Log
4 | import androidx.lifecycle.LiveData
5 | import com.app.network.NetworkClient
6 | import com.app.network.api.AlbumsApi
7 | import com.app.network.cache.Listener
8 | import com.app.network.cache.albums.Album
9 | import com.app.network.cache.albums.AlbumPersist
10 | import kotlinx.coroutines.GlobalScope
11 | import kotlinx.coroutines.launch
12 | import retrofit2.Call
13 | import retrofit2.Callback
14 | import retrofit2.Response
15 | import javax.inject.Inject
16 |
17 |
18 | /**
19 | * Created by Alireza Rafeezadeh on 6/12/2019.
20 | */
21 | class AlbumsDataSource @Inject constructor(
22 | private val networkClient: NetworkClient,
23 | val albumPersist: AlbumPersist
24 | ) {
25 |
26 |
27 | fun getAlbums(listener: Listener>): LiveData> {
28 |
29 | networkClient.getRetrofitService(AlbumsApi::class.java).getAlbums().enqueue(object : Callback> {
30 | override fun onFailure(call: Call>, t: Throwable) {
31 | Log.d("response_posts", t.message)
32 | }
33 |
34 | override fun onResponse(call: Call>, response: Response>) {
35 | response.body()?.let {
36 | listener.onResponse(response = it)
37 | GlobalScope.launch {
38 | albumPersist.save(it)
39 | }
40 | }
41 | }
42 | })
43 |
44 | return albumPersist.load()
45 |
46 | }
47 |
48 | }
--------------------------------------------------------------------------------
/datasource/src/main/java/com/app/network/datasource/PhotosDataSource.kt:
--------------------------------------------------------------------------------
1 | package com.app.network.datasource
2 |
3 | import android.util.Log
4 | import androidx.lifecycle.LiveData
5 | import com.app.network.NetworkClient
6 | import com.app.network.api.PhotosApi
7 | import com.app.network.cache.Listener
8 | import com.app.network.cache.photos.Photo
9 | import com.app.network.cache.photos.PhotoPersist
10 | import kotlinx.coroutines.GlobalScope
11 | import kotlinx.coroutines.launch
12 | import retrofit2.Call
13 | import retrofit2.Callback
14 | import retrofit2.Response
15 | import javax.inject.Inject
16 |
17 |
18 | /**
19 | * Created by Alireza Rafeezadeh on 7/8/2019.
20 | */
21 | class PhotosDataSource @Inject constructor(val networkClient : NetworkClient, val photoPersist : PhotoPersist) {
22 |
23 |
24 | fun getPhotos(listener: Listener>): LiveData> {
25 |
26 | networkClient.getRetrofitService(PhotosApi::class.java).getPhotos().enqueue(object : Callback> {
27 | override fun onFailure(call: Call>, t: Throwable) {
28 | Log.d("response_posts", t.message)
29 | }
30 |
31 | override fun onResponse(call: Call>, response: Response>) {
32 | response.body()?.let {
33 | listener.onResponse(response = it)
34 | GlobalScope.launch {
35 | photoPersist.save(it)
36 | }
37 | }
38 | }
39 | })
40 |
41 | return photoPersist.load()
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/datasource/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Network
3 |
4 |
--------------------------------------------------------------------------------
/datasource/src/test/java/com/app/network/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.app.network;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alireza-rafeezadeh/Modular-App-with-Android-Architecture-Components/0c4c06c704cce9858e5b51ae4985cbccfaf708e3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 07 21:09:41 IRDT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/photos/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/photos/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'kotlin-android'
5 |
6 | apply plugin: 'kotlin-kapt'
7 |
8 |
9 | android {
10 | compileSdkVersion 29
11 |
12 |
13 | defaultConfig {
14 | minSdkVersion 19
15 | targetSdkVersion 29
16 | versionCode 1
17 | versionName "1.0"
18 |
19 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
20 |
21 | }
22 |
23 | buildTypes {
24 | release {
25 | minifyEnabled false
26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27 | }
28 | }
29 |
30 | }
31 |
32 | dependencies {
33 | implementation fileTree(dir: 'libs', include: ['*.jar'])
34 |
35 | implementation project(':datasource')
36 |
37 |
38 | implementation 'androidx.appcompat:appcompat:1.0.2'
39 | testImplementation 'junit:junit:4.12'
40 | androidTestImplementation 'androidx.test:runner:1.2.0'
41 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
42 |
43 |
44 | implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
45 | implementation "androidx.navigation:navigation-fragment:$navigationVersion" // For Kotlin use navigation-fragment-ktx
46 | implementation "androidx.navigation:navigation-ui:$navigationVersion" // For Kotlin use navigation-ui-ktx
47 |
48 |
49 |
50 | // ViewModel and LiveData
51 | implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
52 |
53 | implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
54 |
55 | // alternately - if using Java8, use the following instead of lifecycle-compiler
56 | implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
57 | implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha01"
58 |
59 |
60 | // dagger
61 | implementation "com.google.dagger:dagger:$daggerVersion"
62 | kapt "com.google.dagger:dagger-compiler:$daggerVersion"
63 | // dagger android
64 | implementation "com.google.dagger:dagger-android:$daggerVersion"
65 | implementation "com.google.dagger:dagger-android-support:$daggerVersion" // if you use the support libraries
66 | kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
67 | implementation "androidx.core:core-ktx:$coreKTXVersion"
68 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0"
69 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
70 | }
71 | repositories {
72 | mavenCentral()
73 | }
74 |
--------------------------------------------------------------------------------
/photos/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 |
--------------------------------------------------------------------------------
/photos/src/androidTest/java/com/app/photos/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.app.photos;
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.app.photos.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/photos/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/photos/src/main/java/com/app/photos/base/PhotosFragmentBuilder.kt:
--------------------------------------------------------------------------------
1 | package com.app.photos.base
2 |
3 | import com.app.photos.ui.photos.PhotosFragment
4 | import dagger.Module
5 | import dagger.android.ContributesAndroidInjector
6 |
7 | /**
8 | * Created by Alireza Rafeezadeh on 7/8/2019.
9 | */
10 |
11 | @Module
12 | abstract class PhotosFragmentBuilder {
13 |
14 | @ContributesAndroidInjector
15 | internal abstract fun bindMoviesListFragment(): PhotosFragment
16 |
17 | }
--------------------------------------------------------------------------------
/photos/src/main/java/com/app/photos/ui/photos/PhotosFragment.kt:
--------------------------------------------------------------------------------
1 | package com.app.photos.ui.photos
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.lifecycle.Observer
8 | import androidx.lifecycle.ViewModelProvider
9 | import androidx.lifecycle.ViewModelProviders
10 | import androidx.recyclerview.widget.LinearLayoutManager
11 | import androidx.recyclerview.widget.RecyclerView
12 | import com.app.network.cache.photos.Photo
13 | import com.app.photos.R
14 | import dagger.android.support.DaggerFragment
15 | import kotlinx.android.synthetic.main.fragment_photos.*
16 | import javax.inject.Inject
17 |
18 | /**
19 | * Created by Alireza Rafeezadeh on 7/8/2019.
20 | */
21 |
22 | class PhotosFragment : DaggerFragment() {
23 |
24 | private lateinit var photosViewModel: PhotosViewModel
25 |
26 | @Inject
27 | lateinit var viewModelFactory: ViewModelProvider.Factory
28 |
29 | private lateinit var adapter: PhotosRVAdapter
30 |
31 |
32 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
33 | return inflater.inflate(R.layout.fragment_photos, container, false)
34 | }
35 |
36 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
37 | super.onViewCreated(view, savedInstanceState)
38 | initViewModel()
39 | getData()
40 | initObservers()
41 | }
42 |
43 | private fun initObservers() {
44 | photosViewModel.photosLiveData.observe(this, Observer {
45 | initRecyclerView(photos = it)
46 | })
47 | }
48 |
49 | private fun getData() {
50 | photosViewModel.getPhotos().observe(this, Observer {
51 | initRecyclerView(photos = it)
52 | })
53 | }
54 |
55 | private fun initViewModel() {
56 | photosViewModel = ViewModelProviders.of(this, viewModelFactory)[PhotosViewModel::class.java]
57 | }
58 |
59 |
60 | fun initRecyclerView(photos: List) {
61 | adapter = PhotosRVAdapter(photos)
62 | val layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false)
63 | photosRecyclerView.layoutManager = layoutManager
64 | photosRecyclerView.adapter = adapter
65 | }
66 | }
--------------------------------------------------------------------------------
/photos/src/main/java/com/app/photos/ui/photos/PhotosRVAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.app.photos.ui.photos
2 |
3 | import android.view.LayoutInflater
4 | import android.view.View
5 | import android.view.ViewGroup
6 | import android.widget.TextView
7 | import androidx.recyclerview.widget.RecyclerView
8 | import com.app.network.cache.photos.Photo
9 | import com.app.photos.R
10 |
11 | /**
12 | * Created by Alireza Rafeezadeh on 7/8/2019.
13 | */
14 |
15 | class PhotosRVAdapter(val photos: List) : RecyclerView.Adapter() {
16 |
17 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
18 | val view = LayoutInflater.from(parent.context).inflate(R.layout.item_photo, parent, false)
19 | return ItemViewHolder(itemView = view)
20 | }
21 |
22 | override fun getItemCount(): Int {
23 | return photos.size
24 | }
25 |
26 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
27 | (holder as ItemViewHolder).albumIdTextView.text = photos[position].albumId.toString()
28 | holder.albumTitleTextView.text = photos[position].title
29 | }
30 |
31 | class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
32 | val albumIdTextView: TextView = itemView.findViewById(R.id.albumIdTextView)
33 | val albumTitleTextView: TextView = itemView.findViewById(R.id.albumTitleTextView)
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/photos/src/main/java/com/app/photos/ui/photos/PhotosViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.app.photos.ui.photos
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.lifecycle.MutableLiveData
5 | import androidx.lifecycle.ViewModel
6 | import androidx.navigation.Navigator
7 | import com.app.network.datasource.PhotosDataSource
8 | import com.app.network.cache.Listener
9 | import com.app.network.cache.photos.Photo
10 | import javax.inject.Inject
11 | import javax.inject.Named
12 |
13 | /**
14 | * Created by Alireza Rafeezadeh on 7/8/2019.
15 | */
16 | class PhotosViewModel @Inject constructor(private val photosDataSource: PhotosDataSource) : ViewModel() {
17 |
18 |
19 | var photosLiveData : MutableLiveData> = MutableLiveData()
20 |
21 |
22 | fun getPhotos() : LiveData>{
23 | return photosDataSource.getPhotos(object :
24 | Listener> {
25 | override fun onResponse(response: List) {
26 | photosLiveData.postValue(response)
27 | }
28 |
29 | })
30 |
31 | }
32 |
33 |
34 | }
--------------------------------------------------------------------------------
/photos/src/main/res/layout/fragment_photos.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/photos/src/main/res/layout/item_photo.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/photos/src/main/res/navigation/navigation_photos.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/photos/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | photos
3 | photos://photo
4 |
5 |
--------------------------------------------------------------------------------
/photos/src/test/java/com/app/photos/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.app.photos;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':account', ':albums', ':datasource', ':photos'
2 |
--------------------------------------------------------------------------------