Combine author and artist fields in manga info

(cherry picked from commit 395ca3630c)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt
This commit is contained in:
arkon
2020-06-13 16:25:26 -04:00
committed by Jobobby04
parent adf111c055
commit da7d3f3a9e
8 changed files with 24 additions and 220 deletions
@@ -35,8 +35,6 @@ import kotlinx.android.synthetic.main.manga_all_in_one_header.btn_share
import kotlinx.android.synthetic.main.manga_all_in_one_header.btn_smart_search
import kotlinx.android.synthetic.main.manga_all_in_one_header.btn_tracking
import kotlinx.android.synthetic.main.manga_all_in_one_header.btn_webview
import kotlinx.android.synthetic.main.manga_all_in_one_header.manga_artist
import kotlinx.android.synthetic.main.manga_all_in_one_header.manga_artist_label
import kotlinx.android.synthetic.main.manga_all_in_one_header.manga_author
import kotlinx.android.synthetic.main.manga_all_in_one_header.manga_author_label
import kotlinx.android.synthetic.main.manga_all_in_one_header.manga_chapters
@@ -154,22 +152,6 @@ class MangaAllInOneHolder(
}
.launchIn(adapter.delegate.controllerScope)
manga_artist.longClicks()
.onEach {
adapter.delegate.copyToClipboard(manga_artist_label.text.toString(), manga_artist.text.toString())
}
.launchIn(adapter.delegate.controllerScope)
manga_artist.clicks()
.onEach {
var text = manga_artist.text.toString()
if (adapter.delegate.isEHentaiBasedSource()) {
text = adapter.delegate.wrapTag("artist", text)
}
adapter.delegate.performGlobalSearch(text)
}
.launchIn(adapter.delegate.controllerScope)
manga_author.longClicks()
.onEach {
// EXH Special case E-Hentai/ExHentai to ignore author field (unused)
@@ -228,18 +210,12 @@ class MangaAllInOneHolder(
manga.title
}
// Update artist TextView.
manga_artist.text = if (manga.artist.isNullOrBlank()) {
// Update author/artist TextView.
val authors = listOf(manga.author, manga.artist).filter { !it.isNullOrBlank() }.distinct()
manga_author.text = if (authors.isEmpty()) {
itemView.context.getString(R.string.unknown)
} else {
manga.artist
}
// Update author TextView.
manga_author.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.