Fix leaking back views when swiping in details/recents

Fixes #879
also fixed the rapid collapse/expand of manga description
This commit is contained in:
Jays2Kings 2021-10-15 14:29:53 -04:00
parent 02cacf45b9
commit 256d49b03a
3 changed files with 10 additions and 2 deletions

View file

@ -170,6 +170,7 @@ class MangaHeaderHolder(
private fun expandDesc(animated: Boolean = false) {
binding ?: return
if (binding.moreButton.visibility == View.VISIBLE || isTablet) {
androidx.transition.TransitionManager.endTransitions(adapter.controller.binding.recycler)
binding.mangaSummary.maxLines = Integer.MAX_VALUE
binding.mangaSummary.setTextIsSelectable(true)
setDescription()
@ -205,6 +206,7 @@ class MangaHeaderHolder(
if (isTablet || !canCollapse) return
binding.moreButtonGroup.isVisible = !isTablet
if (animated) {
androidx.transition.TransitionManager.endTransitions(adapter.controller.binding.recycler)
val animVector = AnimatedVectorDrawableCompat.create(
binding.root.context,
R.drawable.anim_expand_less_to_more

View file

@ -146,7 +146,10 @@ class ChapterHolder(
}
private fun resetFrontView() {
if (binding.frontView.translationX != 0f) itemView.post { adapter.notifyItemChanged(flexibleAdapterPosition) }
if (binding.frontView.translationX != 0f) itemView.post {
androidx.transition.TransitionManager.endTransitions(adapter.recyclerView)
adapter.notifyItemChanged(flexibleAdapterPosition)
}
}
fun notifyStatus(status: Download.State, locked: Boolean, progress: Int, animated: Boolean = false) = with(binding.downloadButton.downloadButton) {

View file

@ -156,7 +156,10 @@ class RecentMangaHolder(
}
private fun resetFrontView() {
if (binding.frontView.translationX != 0f) itemView.post { adapter.notifyItemChanged(flexibleAdapterPosition) }
if (binding.frontView.translationX != 0f) itemView.post {
androidx.transition.TransitionManager.endTransitions(adapter.recyclerView)
adapter.notifyItemChanged(flexibleAdapterPosition)
}
}
override fun onLongClick(view: View?): Boolean {