Open abhinav272 opened 6 years ago
Hi @abhinav272 i am also having the same problem. Did you find any solution? Please let us know. Thank you.
@idrisbohra No
Thanks @abhinav272 did you find out any other library based on same animation?
@idrisbohra you can try one thing, there is a way to add animation on recyclerview onCreateViewHolder(), You can specify the enter animation there and see if it's what you expect
@idrisbohra have you found the solution? If not, maybe you can try this
add this to your adapter and make the call from bindViewHolder()
fun setAnimation(viewToAnimate: View, position: Int) {
if (position > lastPosition) {
val animation = AnimationUtils.loadAnimation(viewToAnimate.context, android.R.anim.fade_in)
viewToAnimate.startAnimation(animation)
lastPosition = position
}
}
override fun onViewDetachedFromWindow(holder: CollectionsViewHolder?) {
super.onViewDetachedFromWindow(holder)
holder?.rootLayout!!.clearAnimation()
}
onViewDetachedFromWindow() is called by Android and using here to clear the animation of view which is out of screen when user scolls quickly.
https://github.com/patrick-iv/Enter-animation-demo/blob/7b35deb075d03c9907502ff29e27e3c72beb6368/app/src/main/java/com/patrickiv/demo/enteranimationdemo/fragment/BaseFragment.java#L95
RecyclerView gets data from API call and when data gets populated it gets Animation as expected, but when the user scrolls to end and pagination logic calls for next page data I call runLayoutAnimation() when next page data is available but Animation gets executed on older data set which is already in recyclerview.
I want the Animation to execute only on the new data set.