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) {
fun bind() {
binding.mangaSummary.longClicks()
binding.mangaSummaryText.longClicks()
.onEach {
controller.activity?.copyToClipboard(
view.context.getString(R.string.description),
binding.mangaSummary.text.toString()
binding.mangaSummaryText.text.toString()
)
}
.launchIn(scope)
@ -106,14 +106,14 @@ class MangaInfoItemAdapter(
showMangaInfo(hasInfoContent)
if (hasInfoContent) {
// Update description TextView.
binding.mangaSummary.text = if (manga.description.isNullOrBlank()) {
binding.mangaSummaryText.text = if (manga.description.isNullOrBlank()) {
view.context.getString(R.string.unknown)
} else {
manga.description
}
if (binding.mangaSummary.text == "meta") {
binding.mangaSummary.isVisible = false
if (binding.mangaSummaryText.text == "meta") {
binding.mangaSummaryText.isVisible = false
binding.mangaSummaryLabel.setText(R.string.tags)
}
@ -146,7 +146,7 @@ class MangaInfoItemAdapter(
}
// 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) }
.launchIn(scope)
@ -159,10 +159,7 @@ class MangaInfoItemAdapter(
}
private fun showMangaInfo(visible: Boolean) {
binding.mangaSummaryLabel.isVisible = visible
binding.mangaSummary.isVisible = visible
binding.mangaGenresTagsWrapper.isVisible = visible
binding.mangaInfoToggle.isVisible = visible
binding.mangaSummarySection.isVisible = visible
}
private fun toggleMangaInfo(context: Context) {
@ -183,7 +180,7 @@ class MangaInfoItemAdapter(
}
}
with(binding.mangaSummary) {
with(binding.mangaSummaryText) {
maxLines =
if (isExpanded) {
2

View File

@ -1,5 +1,7 @@
<?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:tools="http://schemas.android.com/tools"
android:orientation="vertical"
@ -42,7 +44,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/manga_summary"
android:id="@+id/manga_summary_text"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -53,14 +55,12 @@
android:focusable="true"
android:maxLines="2"
android:textIsSelectable="false"
android:visibility="gone"
tools:text="Summary"
tools:visibility="visible" />
tools:text="Summary" />
<FrameLayout
android:id="@+id/manga_genres_tags_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
android:layout_height="wrap_content">
<com.google.android.material.chip.ChipGroup
android:id="@+id/manga_genres_tags_full_chips"