mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 18:51:49 +01:00
Hide language tag when only one language is used (#5834)
* Hide lang tag when only one lang used * Comment the code Can't be too useless and do nothing, Ghostbear practically wrote the entire PR for me * Exclude 'all' from counting as a language Co-Authored-By: Andreas <6576096+ghostbear@users.noreply.github.com> * Use existing Preferences directly from Presenter * Replace regex with an existing value Co-authored-by: Andreas <6576096+ghostbear@users.noreply.github.com>
This commit is contained in:
parent
0ea3cc7ce4
commit
763bd54707
@ -260,7 +260,23 @@ class MangaInfoHeaderAdapter(
|
|||||||
val mangaSource = source?.toString()
|
val mangaSource = source?.toString()
|
||||||
with(binding.mangaSource) {
|
with(binding.mangaSource) {
|
||||||
if (mangaSource != null) {
|
if (mangaSource != null) {
|
||||||
text = mangaSource
|
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()
|
||||||
|
} 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()
|
||||||
|
}
|
||||||
|
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
val sourceManager = Injekt.get<SourceManager>()
|
val sourceManager = Injekt.get<SourceManager>()
|
||||||
controller.performSearch(sourceManager.getOrStub(source.id).name)
|
controller.performSearch(sourceManager.getOrStub(source.id).name)
|
||||||
|
Loading…
Reference in New Issue
Block a user