Bugfixes for the combined author/atrist field

This commit is contained in:
Jobobby04 2020-07-05 22:22:59 -04:00
parent b1593e3fe7
commit 63744d5fc4
3 changed files with 13 additions and 1 deletions

View File

@ -188,7 +188,17 @@ class MangaAllInOneHolder(
}
// Update author/artist TextView.
val authors = listOf(manga.author, manga.artist).filter { !it.isNullOrBlank() }.distinct()
val authors: MutableSet<String> = mutableSetOf()
val author = manga.author
val artist = manga.artist
val splitRegex = "([,\\-])".toRegex()
if (author != null) {
authors += author.split(splitRegex).map { it.trim() }.filter { !it.isBlank() }.toMutableSet()
}
if (artist != null) {
authors += artist.split(splitRegex).map { it.trim() }.filter { !it.isBlank() }.toMutableSet()
}
binding.mangaAuthor.text = if (authors.isEmpty()) {
itemView.context.getString(R.string.unknown)
} else {

View File

@ -75,6 +75,7 @@
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="2"
android:textIsSelectable="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/manga_full_title"

View File

@ -75,6 +75,7 @@
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="2"
android:textIsSelectable="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/manga_full_title"