From 63df493cb48d44de8374a4aa064f4d51c632f6c6 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Mon, 10 May 2021 23:42:49 -0400 Subject: [PATCH] More fixes to text selection in manga details Thought about using a dialog popup to select text but it's just so unfriendly I'll stick to the bugs Once again leave it to google to not fix bugs https://issuetracker.google.com/issues/37095917 --- .../tachiyomi/ui/manga/MangaDetailsController.kt | 5 ++++- .../kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt | 12 ++++++------ .../eu/kanade/tachiyomi/ui/manga/MangaHeaderItem.kt | 9 --------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt index 4e6c500f3c..83bae919bd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt @@ -485,7 +485,7 @@ class MangaDetailsController : } colorAnimator?.cancel() - getHeader()?.unbind() + getHeader()?.clearDescFocus() val colorSecondary = activity?.getResourceColor( R.attr.colorSecondary ) ?: Color.BLACK @@ -511,6 +511,9 @@ class MangaDetailsController : if (type == ControllerChangeType.PUSH_ENTER) { binding.swipeRefresh.isRefreshing = presenter.isLoading } + if (!type.isEnter) { + activityBinding?.root?.clearFocus() + } } override fun handleBack(): Boolean { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt index c04ccda591..4a1ff6aaec 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt @@ -27,7 +27,7 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams @SuppressLint("ClickableViewAccessibility") class MangaHeaderHolder( - private val view: View, + view: View, private val adapter: MangaDetailsAdapter, startExpanded: Boolean, isTablet: Boolean = false @@ -201,8 +201,7 @@ class MangaHeaderHolder( else manga.description?.trim() binding.mangaSummary.post { - binding.mangaSummary - if (binding.subItemGroup.visibility != View.GONE) { + if (binding.subItemGroup.isVisible) { if ((binding.mangaSummary.lineCount < 3 && manga.genre.isNullOrBlank()) || binding.lessButton.isVisible) { binding.mangaSummary.setTextIsSelectable(true) binding.moreButtonGroup.isVisible = false @@ -312,9 +311,10 @@ class MangaHeaderHolder( updateCover(manga) } - fun unbind() { - binding?.mangaSummary?.setTextIsSelectable(false) - binding?.mangaSummary?.clearFocus() + fun clearDescFocus() { + binding ?: return + binding.mangaSummary.setTextIsSelectable(false) + binding.mangaSummary.clearFocus() } private fun MaterialButton.checked(checked: Boolean) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderItem.kt index a2c2d99994..336f6674da 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderItem.kt @@ -41,15 +41,6 @@ class MangaHeaderItem(val manga: Manga, var startExpanded: Boolean) : else holder.bind(this, manga) } - override fun unbindViewHolder( - adapter: FlexibleAdapter>?, - holder: MangaHeaderHolder?, - position: Int - ) { - holder?.unbind() - super.unbindViewHolder(adapter, holder, position) - } - override fun equals(other: Any?): Boolean { return (this === other) }