Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -450,20 +454,27 @@ 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
addUpdateListener { animation ->
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()
}
Expand Down