mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Minor cleanup
This commit is contained in:
		| @@ -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<MangaInfoHeaderAdapter.HeaderViewHolder>() { | ||||
|  | ||||
|     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<SourceManager>() | ||||
|                         controller.performSearch(sourceManager.getOrStub(source.id).name) | ||||
|                     } | ||||
|                 } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user