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
This commit is contained in:
Jays2Kings 2021-05-10 23:42:49 -04:00
parent cb7159d22e
commit 63df493cb4
3 changed files with 10 additions and 16 deletions

View File

@ -485,7 +485,7 @@ class MangaDetailsController :
} }
colorAnimator?.cancel() colorAnimator?.cancel()
getHeader()?.unbind() getHeader()?.clearDescFocus()
val colorSecondary = activity?.getResourceColor( val colorSecondary = activity?.getResourceColor(
R.attr.colorSecondary R.attr.colorSecondary
) ?: Color.BLACK ) ?: Color.BLACK
@ -511,6 +511,9 @@ class MangaDetailsController :
if (type == ControllerChangeType.PUSH_ENTER) { if (type == ControllerChangeType.PUSH_ENTER) {
binding.swipeRefresh.isRefreshing = presenter.isLoading binding.swipeRefresh.isRefreshing = presenter.isLoading
} }
if (!type.isEnter) {
activityBinding?.root?.clearFocus()
}
} }
override fun handleBack(): Boolean { override fun handleBack(): Boolean {

View File

@ -27,7 +27,7 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
class MangaHeaderHolder( class MangaHeaderHolder(
private val view: View, view: View,
private val adapter: MangaDetailsAdapter, private val adapter: MangaDetailsAdapter,
startExpanded: Boolean, startExpanded: Boolean,
isTablet: Boolean = false isTablet: Boolean = false
@ -201,8 +201,7 @@ class MangaHeaderHolder(
else manga.description?.trim() else manga.description?.trim()
binding.mangaSummary.post { binding.mangaSummary.post {
binding.mangaSummary if (binding.subItemGroup.isVisible) {
if (binding.subItemGroup.visibility != View.GONE) {
if ((binding.mangaSummary.lineCount < 3 && manga.genre.isNullOrBlank()) || binding.lessButton.isVisible) { if ((binding.mangaSummary.lineCount < 3 && manga.genre.isNullOrBlank()) || binding.lessButton.isVisible) {
binding.mangaSummary.setTextIsSelectable(true) binding.mangaSummary.setTextIsSelectable(true)
binding.moreButtonGroup.isVisible = false binding.moreButtonGroup.isVisible = false
@ -312,9 +311,10 @@ class MangaHeaderHolder(
updateCover(manga) updateCover(manga)
} }
fun unbind() { fun clearDescFocus() {
binding?.mangaSummary?.setTextIsSelectable(false) binding ?: return
binding?.mangaSummary?.clearFocus() binding.mangaSummary.setTextIsSelectable(false)
binding.mangaSummary.clearFocus()
} }
private fun MaterialButton.checked(checked: Boolean) { private fun MaterialButton.checked(checked: Boolean) {

View File

@ -41,15 +41,6 @@ class MangaHeaderItem(val manga: Manga, var startExpanded: Boolean) :
else holder.bind(this, manga) else holder.bind(this, manga)
} }
override fun unbindViewHolder(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>?,
holder: MangaHeaderHolder?,
position: Int
) {
holder?.unbind()
super.unbindViewHolder(adapter, holder, position)
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
return (this === other) return (this === other)
} }