Revert "Revert "Combine author and artist fields in manga info""

This reverts commit 1cc36379e0.
This commit is contained in:
Jobobby04
2020-07-05 21:46:39 -04:00
parent ea8d251e24
commit 73c14df982
8 changed files with 25 additions and 219 deletions
@@ -131,27 +131,11 @@ class MangaAllInOneHolder(
}
.launchIn(adapter.delegate.controllerScope)
binding.mangaArtist.longClicks()
.onEach {
adapter.delegate.copyToClipboard(binding.mangaArtistLabel.text.toString(), binding.mangaArtist.text.toString())
}
.launchIn(adapter.delegate.controllerScope)
binding.mangaArtist.clicks()
.onEach {
var text = binding.mangaArtist.text.toString()
if (adapter.delegate.isEHentaiBasedSource()) {
text = adapter.delegate.wrapTag("artist", text)
}
adapter.delegate.performGlobalSearch(text)
}
.launchIn(adapter.delegate.controllerScope)
binding.mangaAuthor.longClicks()
.onEach {
// EXH Special case E-Hentai/ExHentai to ignore author field (unused)
if (!adapter.delegate.isEHentaiBasedSource()) {
adapter.delegate.copyToClipboard(binding.mangaAuthorLabel.text.toString(), binding.mangaAuthor.text.toString())
adapter.delegate.copyToClipboard("author", binding.mangaAuthor.text.toString())
}
}
.launchIn(adapter.delegate.controllerScope)
@@ -203,18 +187,12 @@ class MangaAllInOneHolder(
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()) {
itemView.context.getString(R.string.unknown)
} else {
manga.artist
}
// Update author TextView.
binding.mangaAuthor.text = if (manga.author.isNullOrBlank()) {
itemView.context.getString(R.string.unknown)
} else {
manga.author
authors.joinToString(", ")
}
// If manga source is known update source TextView.
@@ -176,25 +176,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 {
var text = binding.mangaArtist.text.toString()
if (isEHentaiBasedSource()) {
text = wrapTag("artist", text)
}
performGlobalSearch(text)
}
.launchIn(scope)
binding.mangaAuthor.longClicks()
.onEach {
// EXH Special case E-Hentai/ExHentai to ignore author field (unused)
@@ -337,18 +318,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.