diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouritesCategoriesViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouritesCategoriesViewModel.kt index e5fa046b3..396163140 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouritesCategoriesViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouritesCategoriesViewModel.kt @@ -35,6 +35,7 @@ class FavouritesCategoriesViewModel @Inject constructor( mangaCount = covers.size, covers = covers.take(3), category = category, + isTrackerEnabled = settings.isTrackerEnabled && AppSettings.TRACK_FAVOURITES in settings.trackSources, ) }.ifEmpty { listOf( diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/adapter/CategoryListModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/adapter/CategoryListModel.kt index bdb3d1f5e..6f513ac49 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/adapter/CategoryListModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/adapter/CategoryListModel.kt @@ -8,6 +8,7 @@ class CategoryListModel( val mangaCount: Int, val covers: List, val category: FavouriteCategory, + val isTrackerEnabled: Boolean, ) : ListModel { override fun areItemsTheSame(other: ListModel): Boolean { @@ -21,6 +22,7 @@ class CategoryListModel( other as CategoryListModel if (mangaCount != other.mangaCount) return false + if (isTrackerEnabled != other.isTrackerEnabled) return false if (covers != other.covers) return false if (category.id != other.category.id) return false if (category.title != other.category.title) return false @@ -33,6 +35,7 @@ class CategoryListModel( override fun hashCode(): Int { var result = mangaCount + result = 31 * result + isTrackerEnabled.hashCode() result = 31 * result + covers.hashCode() result = 31 * result + category.id.hashCode() result = 31 * result + category.title.hashCode() diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/MangaCategoriesViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/MangaCategoriesViewModel.kt index 2603d5fbe..7d8c940a1 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/MangaCategoriesViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/MangaCategoriesViewModel.kt @@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.plus import org.koitharu.kotatsu.core.model.ids import org.koitharu.kotatsu.core.model.parcelable.ParcelableManga +import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.ui.BaseViewModel import org.koitharu.kotatsu.core.util.ext.require import org.koitharu.kotatsu.favourites.domain.FavouritesRepository @@ -24,6 +25,7 @@ import javax.inject.Inject class MangaCategoriesViewModel @Inject constructor( savedStateHandle: SavedStateHandle, private val favouritesRepository: FavouritesRepository, + settings: AppSettings, ) : BaseViewModel() { private val manga = savedStateHandle.require>(KEY_MANGA_LIST).map { it.manga } @@ -39,6 +41,7 @@ class MangaCategoriesViewModel @Inject constructor( MangaCategoryItem( category = it, isChecked = it.id in checked, + isTrackerEnabled = settings.isTrackerEnabled && AppSettings.TRACK_FAVOURITES in settings.trackSources, ) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/adapter/MangaCategoryAD.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/adapter/MangaCategoryAD.kt index cb21837a6..0042fe95c 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/adapter/MangaCategoryAD.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/adapter/MangaCategoryAD.kt @@ -22,7 +22,7 @@ fun mangaCategoryAD( bind { payloads -> binding.checkableImageView.setChecked(item.isChecked, ListModelDiffCallback.PAYLOAD_CHECKED_CHANGED !in payloads) binding.textViewTitle.text = item.category.title - binding.imageViewTracker.isVisible = item.category.isTrackingEnabled + binding.imageViewTracker.isVisible = item.category.isTrackingEnabled && item.isTrackerEnabled binding.imageViewVisible.isVisible = item.category.isVisibleInLibrary } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/model/MangaCategoryItem.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/model/MangaCategoryItem.kt index 29c78a142..d5b09a9ca 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/model/MangaCategoryItem.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/model/MangaCategoryItem.kt @@ -7,6 +7,7 @@ import org.koitharu.kotatsu.list.ui.model.ListModel data class MangaCategoryItem( val category: FavouriteCategory, val isChecked: Boolean, + val isTrackerEnabled: Boolean, ) : ListModel { override fun areItemsTheSame(other: ListModel): Boolean { diff --git a/app/src/main/res/xml/pref_services.xml b/app/src/main/res/xml/pref_services.xml index 5dd2472a9..bb35834b0 100644 --- a/app/src/main/res/xml/pref_services.xml +++ b/app/src/main/res/xml/pref_services.xml @@ -19,14 +19,14 @@ + android:title="@string/suggestions" + app:allowDividerAbove="true" /> + android:title="@string/related_manga" />