From 3dc738f28c9ca6b70a21290501cc1516d4351789 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 20 Jun 2020 22:30:02 -0400 Subject: [PATCH] Restore separate artist field --- .../manga/chapter/MangaInfoHeaderAdapter.kt | 32 ++++++++++++++--- .../res/layout-land/manga_info_header.xml | 17 ++++++++-- app/src/main/res/layout/manga_info_header.xml | 34 +++++++++---------- 3 files changed, 58 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt index 5c6eecc8a..56bbdca72 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt @@ -6,6 +6,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat +import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.load.engine.DiskCacheStrategy import eu.kanade.tachiyomi.R @@ -143,6 +144,21 @@ class MangaInfoHeaderAdapter( } .launchIn(scope) + binding.mangaArtist.longClicks() + .onEach { + controller.activity?.copyToClipboard( + binding.mangaArtist.text.toString(), + binding.mangaArtist.text.toString() + ) + } + .launchIn(scope) + + binding.mangaArtist.clicks() + .onEach { + controller.performGlobalSearch(binding.mangaArtist.text.toString()) + } + .launchIn(scope) + binding.mangaSummary.longClicks() .onEach { controller.activity?.copyToClipboard( @@ -172,19 +188,25 @@ class MangaInfoHeaderAdapter( * @param source the source of the manga. */ private fun setMangaInfo(manga: Manga, source: Source?) { - // update full title TextView. + // Update full title TextView. binding.mangaFullTitle.text = if (manga.title.isBlank()) { view.context.getString(R.string.unknown) } else { manga.title } - // Update author/artist TextView. - val authors = listOf(manga.author, manga.artist).filter { !it.isNullOrBlank() }.distinct() - binding.mangaAuthor.text = if (authors.isEmpty()) { + // Update author TextView. + binding.mangaAuthor.text = if (manga.author.isNullOrBlank()) { view.context.getString(R.string.unknown) } else { - authors.joinToString(", ") + manga.author + } + + // Update artist TextView. + val hasArtist = !manga.artist.isNullOrBlank() && manga.artist != manga.author + binding.mangaArtist.isVisible = hasArtist + if (hasArtist) { + binding.mangaArtist.text = manga.artist } // If manga source is known update source TextView. diff --git a/app/src/main/res/layout-land/manga_info_header.xml b/app/src/main/res/layout-land/manga_info_header.xml index 1bc76b04c..ff2efa2c8 100644 --- a/app/src/main/res/layout-land/manga_info_header.xml +++ b/app/src/main/res/layout-land/manga_info_header.xml @@ -52,12 +52,21 @@ style="@style/TextAppearance.Regular.Body1.Secondary" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginTop="8dp" android:textIsSelectable="false" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/manga_full_title" tools:text="Author" /> + + + app:layout_constraintTop_toBottomOf="@+id/manga_artist" + tools:text="Source" /> + app:layout_constraintTop_toBottomOf="@+id/manga_status" + tools:text="Status" /> diff --git a/app/src/main/res/layout/manga_info_header.xml b/app/src/main/res/layout/manga_info_header.xml index d7f8e45dc..b72ac19cd 100644 --- a/app/src/main/res/layout/manga_info_header.xml +++ b/app/src/main/res/layout/manga_info_header.xml @@ -55,10 +55,11 @@ app:layout_constraintTop_toTopOf="parent" tools:src="@mipmap/ic_launcher" /> - + app:autoSizeTextType="uniform" /> + + + tools:text="Status" /> + tools:text="Source" /> - +