From 74a7e2a17e34decbd9d462a8e3a959a75e34f4de Mon Sep 17 00:00:00 2001 From: len Date: Sat, 17 Jun 2017 12:46:34 +0200 Subject: [PATCH] Fix local source not working if english was disabled. Closes #848 --- .../main/java/eu/kanade/tachiyomi/source/LocalSource.kt | 2 +- .../kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt index d63c90844..00662ceb9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt @@ -57,7 +57,7 @@ class LocalSource(private val context: Context) : CatalogueSource { override val id = ID override val name = "LocalSource" - override val lang = "en" + override val lang = "" override val supportsLatest = true override fun toString() = context.getString(R.string.local_source) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt index b9a08bdef..69fd34db7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt @@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.database.models.MangaCategory import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.source.CatalogueSource +import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.Filter @@ -303,15 +304,11 @@ open class CataloguePresenter( val languages = prefs.enabledLanguages().getOrDefault() val hiddenCatalogues = prefs.hiddenCatalogues().getOrDefault() - // Ensure at least one language - if (languages.isEmpty()) { - languages.add("en") - } - return sourceManager.getCatalogueSources() .filter { it.lang in languages } .filterNot { it.id.toString() in hiddenCatalogues } - .sortedBy { "(${it.lang}) ${it.name}" } + .sortedBy { "(${it.lang}) ${it.name}" } + + sourceManager.get(LocalSource.ID) as LocalSource } /**