I'm having problems with views not refreshing in MotionLayout.
Seems like at some point the refresh/redraw mechanism of MotionLayout becomes broken and the subviews (including the nested ones) are having random problems updating themselves on the screen. What I have experienced so far:
RecyclerViewis not refreshed sometimes. This happens when new data is available, I'm using Paging library to fill the data. I have fixed it with a workaround of scrolling 1 pixel when I got new data there -recyclerView.smoothScrollBy(0,1). After that theRecyclerViewstarts redrawing itself just fine.- When the keyboard is opened it randomly messes the nested subview redrawing. There is an issue in github here where a guy reproduces all this by adding an
EditTextto officialMotionLayoutexamples. Some examples of the problems that I'm seeing:- I'm using
TextInputLayoutwithapp:endIconMode="clear_text"inMotionLayout -> ConstraintLayout -> TextInputLayoutand theXbutton is sometimes not shown when I start typing (also after closing the keyboard). TextViewis redrawn partially! I'm showing"No Results"or"No Posts"text in aTextView, switching between them based on some logic, but instead of refreshing the whole text only"No"is shown in the UI. I have debugged it, Layout Inspector says everything is fine, the text view value is"No Results", but I don't see it on the screen.- Some other animations are broken, like indeterminate progress animation of nested
SwipeRefreshLayout
- I'm using
IMPORTANT: All the refresh/redraw issues are fixed when I do a transition! When I come to some messed state where 3 nested subviews are frozen/partially drawn, then I just need to press a button that triggers my transition, and all of them are happily redrawing themselves!
Please let me know if this is a known problem and if there is a workaround for this. I could do invisible 1 pixel transition maybe, but I cannot even detect when the MotionLayout refreshing becomes broken, handling keyboard and new data of RecyclerView doesn't seem to cover all the cases. Otherwise, I will have to move back to ConstraintLayout and think on implementing the amazing OnSwipe functionality myself (if that is even possible in ConstraintLayout).