Combine author and artist fields in manga info

This commit is contained in:
arkon
2020-06-13 16:25:26 -04:00
parent e9fbdb660b
commit 395ca3630c
5 changed files with 12 additions and 108 deletions

View File

@ -137,21 +137,6 @@ class MangaInfoController(private val fromSource: Boolean = false) :
}
.launchIn(scope)
binding.mangaArtist.longClicks()
.onEach {
activity?.copyToClipboard(
binding.mangaArtistLabel.text.toString(),
binding.mangaArtist.text.toString()
)
}
.launchIn(scope)
binding.mangaArtist.clicks()
.onEach {
performGlobalSearch(binding.mangaArtist.text.toString())
}
.launchIn(scope)
binding.mangaAuthor.longClicks()
.onEach {
activity?.copyToClipboard(
@ -231,18 +216,12 @@ class MangaInfoController(private val fromSource: Boolean = false) :
manga.title
}
// Update artist TextView.
binding.mangaArtist.text = if (manga.artist.isNullOrBlank()) {
// Update author/artist TextView.
val authors = listOf(manga.author, manga.artist).filter { !it.isNullOrBlank() }.distinct()
binding.mangaAuthor.text = if (authors.isEmpty()) {
view.context.getString(R.string.unknown)
} else {
manga.artist
}
// Update author TextView.
binding.mangaAuthor.text = if (manga.author.isNullOrBlank()) {
view.context.getString(R.string.unknown)
} else {
manga.author
authors.joinToString(", ")
}
// If manga source is known update source TextView.