diff --git a/app/build.gradle b/app/build.gradle index eac4a55..4eb083f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,6 +32,7 @@ dependencies { androidTestImplementation testLibraries.espresso // These libraries required by dagger to create dependency graph, but not by app + compileOnly project(':repository') compileOnly libraries.retrofit compileOnly libraries.room compileOnly libraries.paging diff --git a/app/src/main/kotlin/com/melih/rocketscience/di/AppModule.kt b/app/src/main/kotlin/com/melih/rocketscience/di/AppModule.kt index 2cc3b52..65eabe5 100644 --- a/app/src/main/kotlin/com/melih/rocketscience/di/AppModule.kt +++ b/app/src/main/kotlin/com/melih/rocketscience/di/AppModule.kt @@ -1,7 +1,7 @@ package com.melih.rocketscience.di import com.melih.detail.di.DetailContributor -import com.melih.list.di.LaunchesContributor +import com.melih.launches.di.LaunchesContributor import com.melih.rocketscience.MainActivity import dagger.Module import dagger.android.ContributesAndroidInjector diff --git a/core/build.gradle b/core/build.gradle index 96de2b7..ef8cb83 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -14,7 +14,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - api project(":repository") + implementation project(':repository') implementation libraries.fragment implementation libraries.paging @@ -28,6 +28,4 @@ dependencies { testImplementation testLibraries.mockk testImplementation testLibraries.kluent testImplementation testLibraries.coroutinesTest - - compileOnly libraries.room } diff --git a/docs/module_graph.png b/docs/module_graph.png index 93bab79..7add4b6 100644 Binary files a/docs/module_graph.png and b/docs/module_graph.png differ diff --git a/features/detail/build.gradle b/features/detail/build.gradle index cea8317..43a02bd 100644 --- a/features/detail/build.gradle +++ b/features/detail/build.gradle @@ -14,5 +14,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(':repository') + testImplementation testLibraries.coroutinesTest } diff --git a/features/detail/src/main/kotlin/com/melih/detail/di/DetailContributor.kt b/features/detail/src/main/kotlin/com/melih/detail/di/DetailContributor.kt index 6a648c9..ad1b7fa 100644 --- a/features/detail/src/main/kotlin/com/melih/detail/di/DetailContributor.kt +++ b/features/detail/src/main/kotlin/com/melih/detail/di/DetailContributor.kt @@ -1,8 +1,8 @@ package com.melih.detail.di import com.melih.detail.di.modules.DetailFragmentModule +import com.melih.detail.di.scopes.DetailFragmentScope import com.melih.detail.ui.DetailFragment -import com.melih.list.di.scopes.DetailFragmentScope import dagger.Module import dagger.android.ContributesAndroidInjector diff --git a/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailFragmentScope.kt b/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailFragmentScope.kt index c5a983b..61e38e2 100644 --- a/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailFragmentScope.kt +++ b/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailFragmentScope.kt @@ -1,4 +1,4 @@ -package com.melih.list.di.scopes +package com.melih.detail.di.scopes import javax.inject.Scope diff --git a/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailScope.kt b/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailScope.kt index e264fde..93d96b0 100644 --- a/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailScope.kt +++ b/features/detail/src/main/kotlin/com/melih/detail/di/scopes/DetailScope.kt @@ -1,4 +1,4 @@ -package com.melih.list.di.scopes +package com.melih.detail.di.scopes import javax.inject.Scope diff --git a/features/launches/build.gradle b/features/launches/build.gradle index 740d414..78a3446 100644 --- a/features/launches/build.gradle +++ b/features/launches/build.gradle @@ -7,6 +7,8 @@ apply from: "$rootProject.projectDir/scripts/feature_module.gradle" dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(':repository') + implementation libraries.paging implementation libraries.swipeRefreshLayout diff --git a/features/launches/src/main/AndroidManifest.xml b/features/launches/src/main/AndroidManifest.xml index c857a13..01b8e2a 100644 --- a/features/launches/src/main/AndroidManifest.xml +++ b/features/launches/src/main/AndroidManifest.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/features/launches/src/main/kotlin/com/melih/list/di/LaunchesContributor.kt b/features/launches/src/main/kotlin/com/melih/launches/di/LaunchesContributor.kt similarity index 67% rename from features/launches/src/main/kotlin/com/melih/list/di/LaunchesContributor.kt rename to features/launches/src/main/kotlin/com/melih/launches/di/LaunchesContributor.kt index 7de0829..a69725e 100644 --- a/features/launches/src/main/kotlin/com/melih/list/di/LaunchesContributor.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/di/LaunchesContributor.kt @@ -1,8 +1,8 @@ -package com.melih.list.di +package com.melih.launches.di -import com.melih.list.di.modules.LaunchesFragmentModule -import com.melih.list.di.scopes.LaunchesFragmentScope -import com.melih.list.ui.LaunchesFragment +import com.melih.launches.di.modules.LaunchesFragmentModule +import com.melih.launches.di.scopes.LaunchesFragmentScope +import com.melih.launches.ui.LaunchesFragment import dagger.Module import dagger.android.ContributesAndroidInjector diff --git a/features/launches/src/main/kotlin/com/melih/list/di/modules/LaunchesFragmentModule.kt b/features/launches/src/main/kotlin/com/melih/launches/di/modules/LaunchesFragmentModule.kt similarity index 91% rename from features/launches/src/main/kotlin/com/melih/list/di/modules/LaunchesFragmentModule.kt rename to features/launches/src/main/kotlin/com/melih/launches/di/modules/LaunchesFragmentModule.kt index fc47acb..207eaf3 100644 --- a/features/launches/src/main/kotlin/com/melih/list/di/modules/LaunchesFragmentModule.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/di/modules/LaunchesFragmentModule.kt @@ -1,9 +1,9 @@ -package com.melih.list.di.modules +package com.melih.launches.di.modules import androidx.lifecycle.ViewModel import androidx.paging.Config import com.melih.core.di.keys.ViewModelKey -import com.melih.list.ui.vm.LaunchesViewModel +import com.melih.launches.ui.vm.LaunchesViewModel import com.melih.repository.interactors.DEFAULT_LAUNCHES_AMOUNT import com.melih.repository.interactors.GetLaunches import dagger.Binds diff --git a/features/launches/src/main/kotlin/com/melih/list/di/scopes/LaunchesFragmentScope.kt b/features/launches/src/main/kotlin/com/melih/launches/di/scopes/LaunchesFragmentScope.kt similarity index 75% rename from features/launches/src/main/kotlin/com/melih/list/di/scopes/LaunchesFragmentScope.kt rename to features/launches/src/main/kotlin/com/melih/launches/di/scopes/LaunchesFragmentScope.kt index e5b898b..eb5898f 100644 --- a/features/launches/src/main/kotlin/com/melih/list/di/scopes/LaunchesFragmentScope.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/di/scopes/LaunchesFragmentScope.kt @@ -1,4 +1,4 @@ -package com.melih.list.di.scopes +package com.melih.launches.di.scopes import javax.inject.Scope diff --git a/features/launches/src/main/kotlin/com/melih/list/di/scopes/LaunchesScope.kt b/features/launches/src/main/kotlin/com/melih/launches/di/scopes/LaunchesScope.kt similarity index 73% rename from features/launches/src/main/kotlin/com/melih/list/di/scopes/LaunchesScope.kt rename to features/launches/src/main/kotlin/com/melih/launches/di/scopes/LaunchesScope.kt index 31b4887..24baafb 100644 --- a/features/launches/src/main/kotlin/com/melih/list/di/scopes/LaunchesScope.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/di/scopes/LaunchesScope.kt @@ -1,4 +1,4 @@ -package com.melih.list.di.scopes +package com.melih.launches.di.scopes import javax.inject.Scope diff --git a/features/launches/src/main/kotlin/com/melih/list/ui/LaunchesFragment.kt b/features/launches/src/main/kotlin/com/melih/launches/ui/LaunchesFragment.kt similarity index 87% rename from features/launches/src/main/kotlin/com/melih/list/ui/LaunchesFragment.kt rename to features/launches/src/main/kotlin/com/melih/launches/ui/LaunchesFragment.kt index c4e02e7..e29d29c 100644 --- a/features/launches/src/main/kotlin/com/melih/list/ui/LaunchesFragment.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/ui/LaunchesFragment.kt @@ -1,4 +1,4 @@ -package com.melih.list.ui +package com.melih.launches.ui import android.os.Bundle import android.view.View @@ -7,10 +7,10 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.melih.core.actions.openDetail import com.melih.core.base.lifecycle.BaseDaggerFragment import com.melih.core.extensions.observe -import com.melih.list.R -import com.melih.list.databinding.ListBinding -import com.melih.list.ui.adapters.LaunchesAdapter -import com.melih.list.ui.vm.LaunchesViewModel +import com.melih.launches.R +import com.melih.launches.databinding.ListBinding +import com.melih.launches.ui.adapters.LaunchesAdapter +import com.melih.launches.ui.vm.LaunchesViewModel import com.melih.repository.entities.LaunchEntity import com.melih.repository.interactors.base.PersistenceEmpty import com.melih.repository.interactors.base.State @@ -49,6 +49,11 @@ class LaunchesFragment : BaseDaggerFragment(), SwipeRefreshLayout.O // Workaround for SwipeRefreshLayout leak -> https://issuetracker.google.com/issues/136153683 binding.swipeRefreshLayout.isEnabled = false } + + override fun onDestroyView() { + super.onDestroyView() + binding.rocketList.adapter = null + } //endregion //region Functions diff --git a/features/launches/src/main/kotlin/com/melih/list/ui/adapters/LaunchesAdapter.kt b/features/launches/src/main/kotlin/com/melih/launches/ui/adapters/LaunchesAdapter.kt similarity index 92% rename from features/launches/src/main/kotlin/com/melih/list/ui/adapters/LaunchesAdapter.kt rename to features/launches/src/main/kotlin/com/melih/launches/ui/adapters/LaunchesAdapter.kt index d759333..d9e88ec 100644 --- a/features/launches/src/main/kotlin/com/melih/list/ui/adapters/LaunchesAdapter.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/ui/adapters/LaunchesAdapter.kt @@ -1,11 +1,11 @@ -package com.melih.list.ui.adapters +package com.melih.launches.ui.adapters import android.view.LayoutInflater import android.view.ViewGroup import com.melih.core.base.recycler.BasePagingListAdapter import com.melih.core.base.recycler.BaseViewHolder import com.melih.core.extensions.createDiffCallback -import com.melih.list.databinding.LaunchRowBinding +import com.melih.launches.databinding.LaunchRowBinding import com.melih.repository.entities.LaunchEntity class LaunchesAdapter(itemClickListener: (LaunchEntity) -> Unit) : BasePagingListAdapter( diff --git a/features/launches/src/main/kotlin/com/melih/list/ui/paging/LaunchesPagingSource.kt b/features/launches/src/main/kotlin/com/melih/launches/ui/paging/LaunchesPagingSource.kt similarity index 95% rename from features/launches/src/main/kotlin/com/melih/list/ui/paging/LaunchesPagingSource.kt rename to features/launches/src/main/kotlin/com/melih/launches/ui/paging/LaunchesPagingSource.kt index a234c44..6dc3056 100644 --- a/features/launches/src/main/kotlin/com/melih/list/ui/paging/LaunchesPagingSource.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/ui/paging/LaunchesPagingSource.kt @@ -1,4 +1,4 @@ -package com.melih.list.ui.paging +package com.melih.launches.ui.paging import com.melih.core.base.paging.BasePagingDataSource import com.melih.repository.entities.LaunchEntity diff --git a/features/launches/src/main/kotlin/com/melih/list/ui/paging/LaunchesPagingSourceFactory.kt b/features/launches/src/main/kotlin/com/melih/launches/ui/paging/LaunchesPagingSourceFactory.kt similarity index 93% rename from features/launches/src/main/kotlin/com/melih/list/ui/paging/LaunchesPagingSourceFactory.kt rename to features/launches/src/main/kotlin/com/melih/launches/ui/paging/LaunchesPagingSourceFactory.kt index f9f7c46..98b3485 100644 --- a/features/launches/src/main/kotlin/com/melih/list/ui/paging/LaunchesPagingSourceFactory.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/ui/paging/LaunchesPagingSourceFactory.kt @@ -1,4 +1,4 @@ -package com.melih.list.ui.paging +package com.melih.launches.ui.paging import com.melih.core.base.paging.BasePagingDataSource import com.melih.core.base.paging.BasePagingFactory diff --git a/features/launches/src/main/kotlin/com/melih/list/ui/vm/LaunchesViewModel.kt b/features/launches/src/main/kotlin/com/melih/launches/ui/vm/LaunchesViewModel.kt similarity index 87% rename from features/launches/src/main/kotlin/com/melih/list/ui/vm/LaunchesViewModel.kt rename to features/launches/src/main/kotlin/com/melih/launches/ui/vm/LaunchesViewModel.kt index fc45b4c..39133a7 100644 --- a/features/launches/src/main/kotlin/com/melih/list/ui/vm/LaunchesViewModel.kt +++ b/features/launches/src/main/kotlin/com/melih/launches/ui/vm/LaunchesViewModel.kt @@ -1,9 +1,9 @@ -package com.melih.list.ui.vm +package com.melih.launches.ui.vm import androidx.paging.PagedList import com.melih.core.base.paging.BasePagingFactory import com.melih.core.base.viewmodel.BasePagingViewModel -import com.melih.list.ui.paging.LaunchesPagingSourceFactory +import com.melih.launches.ui.paging.LaunchesPagingSourceFactory import com.melih.repository.entities.LaunchEntity import javax.inject.Inject diff --git a/features/launches/src/main/res/layout/fragment_launches.xml b/features/launches/src/main/res/layout/fragment_launches.xml index dce7104..f9f368d 100644 --- a/features/launches/src/main/res/layout/fragment_launches.xml +++ b/features/launches/src/main/res/layout/fragment_launches.xml @@ -8,7 +8,7 @@ + type="com.melih.launches.ui.vm.LaunchesViewModel" /> + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/nav_launches" + app:startDestination="@id/launchesFragment" + tools:ignore="UnusedNavigation"> - - \ No newline at end of file + + diff --git a/features/launches/src/test/kotlin/com/melih/list/BaseTestWithMainThread.kt b/features/launches/src/test/kotlin/com/melih/launches/BaseTestWithMainThread.kt similarity index 89% rename from features/launches/src/test/kotlin/com/melih/list/BaseTestWithMainThread.kt rename to features/launches/src/test/kotlin/com/melih/launches/BaseTestWithMainThread.kt index 358b7d3..c04f0ac 100644 --- a/features/launches/src/test/kotlin/com/melih/list/BaseTestWithMainThread.kt +++ b/features/launches/src/test/kotlin/com/melih/launches/BaseTestWithMainThread.kt @@ -1,6 +1,6 @@ @file:UseExperimental(ExperimentalCoroutinesApi::class) -package com.melih.list +package com.melih.launches import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -10,6 +10,7 @@ import kotlinx.coroutines.test.setMain import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach +@UseExperimental(ExperimentalCoroutinesApi::class) abstract class BaseTestWithMainThread { protected val dispatcher = TestCoroutineDispatcher()