diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt index 47e274b9e..d18ce31d0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt @@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView import com.google.android.material.dialog.MaterialAlertDialogBuilder import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga +import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.databinding.MangaInfoHeaderBinding import eu.kanade.tachiyomi.source.Source @@ -26,8 +27,6 @@ import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.onEach import reactivecircus.flowbinding.android.view.clicks import reactivecircus.flowbinding.android.view.longClicks -import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy class MangaInfoHeaderAdapter( @@ -38,6 +37,8 @@ class MangaInfoHeaderAdapter( RecyclerView.Adapter() { private val trackManager: TrackManager by injectLazy() + private val preferences: PreferencesHelper by injectLazy() + private val sourceManager: SourceManager by injectLazy() private var manga: Manga = controller.presenter.manga private var source: Source = controller.presenter.source @@ -260,25 +261,23 @@ class MangaInfoHeaderAdapter( val mangaSource = source?.toString() with(binding.mangaSource) { if (mangaSource != null) { - val preferences = controller.presenter.preferences val enabledLanguages = preferences.enabledLanguages().get() .filterNot { it == "all" } text = if (enabledLanguages.size == 1) { // For edge cases where user disables a source they got manga of in their library. if (source.lang !in enabledLanguages) { - source.toString() + mangaSource } else { // Hide the language tag when only one language is used. source.name } } else { // Display the language tag when multiple languages are used. - source.toString() + mangaSource } setOnClickListener { - val sourceManager = Injekt.get() controller.performSearch(sourceManager.getOrStub(source.id).name) } } else {