From 2a8f6fb2b7906d080226ef0293aa529eb905495c Mon Sep 17 00:00:00 2001 From: Mabuchi Nyirenda <79569415+BuchiNy@users.noreply.github.com> Date: Thu, 22 May 2025 13:25:59 +0200 Subject: [PATCH] fix: collapsed not bug fix for when you collapse a long note and then expand it, the note text would get cut and it is scrollable. --- .../ui/fragments/BodyFragment.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/apphatchery/gatbreferenceguide/ui/fragments/BodyFragment.kt b/app/src/main/java/org/apphatchery/gatbreferenceguide/ui/fragments/BodyFragment.kt index 786213e..b633737 100644 --- a/app/src/main/java/org/apphatchery/gatbreferenceguide/ui/fragments/BodyFragment.kt +++ b/app/src/main/java/org/apphatchery/gatbreferenceguide/ui/fragments/BodyFragment.kt @@ -435,6 +435,10 @@ class BodyFragment : BaseFragment(R.layout.fragment_body) { fun expandRecyclerView(recyclerView: RecyclerView) { + + recyclerView.layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT + recyclerView.requestLayout() + recyclerView.measure( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT @@ -450,12 +454,15 @@ class BodyFragment : BaseFragment(R.layout.fragment_body) { recyclerView.layoutParams.height = animation.animatedValue as Int recyclerView.requestLayout() } + doOnEnd { + recyclerView.layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT + } } animator.start() } fun collapseRecyclerView(recyclerView: RecyclerView) { - val initialHeight = recyclerView.measuredHeight + val initialHeight = recyclerView.height val animator = ValueAnimator.ofInt(initialHeight, 0).apply { duration = 300 @@ -463,7 +470,11 @@ class BodyFragment : BaseFragment(R.layout.fragment_body) { recyclerView.layoutParams.height = animation.animatedValue as Int recyclerView.requestLayout() } - doOnEnd { recyclerView.visibility = View.GONE } + doOnEnd { + recyclerView.visibility = View.GONE + + recyclerView.layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT + } } animator.start() }