From 8a064c118f8661192d15c6b88ad890d044d2d029 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 4 Sep 2021 15:27:37 -0400 Subject: [PATCH] Minor cleanup --- .../tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 47e274b9e6..d18ce31d0b 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 {