Fix tap region for manga summary

(cherry picked from commit e990ad25eb80317b915abc042fdc3085da070e84)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt
#	app/src/main/res/layout/manga_info_header.xml
This commit is contained in:
arkon 2020-07-31 12:58:13 -04:00 committed by Jobobby04
parent 337d270d2a
commit 5e59d05598
2 changed files with 14 additions and 17 deletions

View File

@ -78,11 +78,11 @@ class MangaInfoItemAdapter(
inner class HeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { inner class HeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
fun bind() { fun bind() {
binding.mangaSummary.longClicks() binding.mangaSummaryText.longClicks()
.onEach { .onEach {
controller.activity?.copyToClipboard( controller.activity?.copyToClipboard(
view.context.getString(R.string.description), view.context.getString(R.string.description),
binding.mangaSummary.text.toString() binding.mangaSummaryText.text.toString()
) )
} }
.launchIn(scope) .launchIn(scope)
@ -106,14 +106,14 @@ class MangaInfoItemAdapter(
showMangaInfo(hasInfoContent) showMangaInfo(hasInfoContent)
if (hasInfoContent) { if (hasInfoContent) {
// Update description TextView. // Update description TextView.
binding.mangaSummary.text = if (manga.description.isNullOrBlank()) { binding.mangaSummaryText.text = if (manga.description.isNullOrBlank()) {
view.context.getString(R.string.unknown) view.context.getString(R.string.unknown)
} else { } else {
manga.description manga.description
} }
if (binding.mangaSummary.text == "meta") { if (binding.mangaSummaryText.text == "meta") {
binding.mangaSummary.isVisible = false binding.mangaSummaryText.isVisible = false
binding.mangaSummaryLabel.setText(R.string.tags) binding.mangaSummaryLabel.setText(R.string.tags)
} }
@ -146,7 +146,7 @@ class MangaInfoItemAdapter(
} }
// Handle showing more or less info // Handle showing more or less info
merge(view.clicks(), binding.mangaSummary.clicks(), binding.mangaInfoToggle.clicks()) merge(binding.mangaSummarySection.clicks(), binding.mangaSummaryText.clicks(), binding.mangaInfoToggle.clicks())
.onEach { toggleMangaInfo(view.context) } .onEach { toggleMangaInfo(view.context) }
.launchIn(scope) .launchIn(scope)
@ -159,10 +159,7 @@ class MangaInfoItemAdapter(
} }
private fun showMangaInfo(visible: Boolean) { private fun showMangaInfo(visible: Boolean) {
binding.mangaSummaryLabel.isVisible = visible binding.mangaSummarySection.isVisible = visible
binding.mangaSummary.isVisible = visible
binding.mangaGenresTagsWrapper.isVisible = visible
binding.mangaInfoToggle.isVisible = visible
} }
private fun toggleMangaInfo(context: Context) { private fun toggleMangaInfo(context: Context) {
@ -183,7 +180,7 @@ class MangaInfoItemAdapter(
} }
} }
with(binding.mangaSummary) { with(binding.mangaSummaryText) {
maxLines = maxLines =
if (isExpanded) { if (isExpanded) {
2 2

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
android:id="@+id/manga_summary_section"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
@ -42,7 +44,7 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
android:id="@+id/manga_summary" android:id="@+id/manga_summary_text"
style="@style/TextAppearance.Regular.Body1.Secondary" style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -53,14 +55,12 @@
android:focusable="true" android:focusable="true"
android:maxLines="2" android:maxLines="2"
android:textIsSelectable="false" android:textIsSelectable="false"
android:visibility="gone" tools:text="Summary" />
tools:text="Summary"
tools:visibility="visible" />
<FrameLayout <FrameLayout
android:id="@+id/manga_genres_tags_wrapper" android:id="@+id/manga_genres_tags_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<com.google.android.material.chip.ChipGroup <com.google.android.material.chip.ChipGroup
android:id="@+id/manga_genres_tags_full_chips" android:id="@+id/manga_genres_tags_full_chips"