Is this a general databinding issue or question? You are more likely to get a
response from somewhere like
StackOverflow.
Issue
Our team uses me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:4.0.0 extensively and hasn't encountered any major issues until recently. We have started to investigate how to use MotionLayout in our apps and faced a challenge when the widget is combined with this library.
I have created a tiny Android project that should be self-explanatory where a switch of the container of quiz__multiple from ConstraintLayout to MotionLayout causes the RecyclerView's elements not to be shown.
Some background
We are both feeding a ViewPager2 with a collection of a custom SubViewModels while each SubViewModel in turn has binding data that RecyclerView is fed with.
We are using ViewStub to conditionally inflate various (heavy) layouts. The inflated layouts are also data bound and need to explicitly be assigned a LifecycleOwner and we do that by hooking into ViewStub's data binding adapters:
The issue is that if the user doesn't interact with the (hidden) RecyclerView its content will not be shown.
My best guess is that this is due to the OnRebindCallback that BindingRecyclerViewAdapter registers. Note that the issue does not occur if the MotionLayout is swapped with ConstraintLayout. The animation seems to be the culprit.
Is this a general databinding issue or question? You are more likely to get a response from somewhere like StackOverflow.
Issue
Our team uses
me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:4.0.0
extensively and hasn't encountered any major issues until recently. We have started to investigate how to use MotionLayout in our apps and faced a challenge when the widget is combined with this library.I have created a tiny Android project that should be self-explanatory where a switch of the container of
quiz__multiple
fromConstraintLayout
toMotionLayout
causes theRecyclerView
's elements not to be shown.Some background
We are both feeding a
ViewPager2
with a collection of a customSubViewModel
s while eachSubViewModel
in turn has binding data thatRecyclerView
is fed with.We are using
ViewStub
to conditionally inflate various (heavy) layouts. The inflated layouts are also data bound and need to explicitly be assigned aLifecycleOwner
and we do that by hooking intoViewStub
's data binding adapters:The issue is that if the user doesn't interact with the (hidden)
RecyclerView
its content will not be shown.My best guess is that this is due to the
OnRebindCallback
thatBindingRecyclerViewAdapter
registers. Note that the issue does not occur if theMotionLayout
is swapped withConstraintLayout
. The animation seems to be the culprit.