diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt index 969f789ad..25abe55ee 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt @@ -36,6 +36,9 @@ open class SourceManager(private val context: Context) { if (overwrite || !sourcesMap.containsKey(source.id)) { sourcesMap[source.id] = source } + if (overwrite || !stubSourcesMap.containsKey(source.id)) { + stubSourcesMap[source.id] = StubSource(source.id) + } } internal fun unregisterSource(source: Source) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt index cd1eb7b82..c27a1890e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt @@ -13,13 +13,18 @@ import eu.davidea.flexibleadapter.items.IFlexible import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.LibraryManga import eu.kanade.tachiyomi.data.preference.getOrDefault +import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.widget.AutofitRecyclerView import kotlinx.android.synthetic.main.catalogue_grid_item.view.card import kotlinx.android.synthetic.main.catalogue_grid_item.view.gradient +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference) : AbstractFlexibleItem(), IFilterable { + private val sourceManager: SourceManager = Injekt.get() + var downloadCount = -1 override fun getLayoutRes(): Int { @@ -48,7 +53,6 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference holder: LibraryHolder, position: Int, payloads: List?) { - holder.onSetValues(this) } @@ -62,6 +66,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference return manga.title.contains(constraint, true) || (manga.author?.contains(constraint, true) ?: false) || (manga.artist?.contains(constraint, true) ?: false) || + sourceManager.getOrStub(manga.source).name.contains(constraint, true) || if (constraint.contains(",")) { val genres = manga.genre?.split(", ") constraint.split(",").all { containsGenre(it.trim(), genres) }