[MaterialDividerItemDecoration] The decorator in the last item with isLastItemDecorated false is blinking in a dropdown view showing and hiding the decorator very fast
https://github.com/material-components/material-components-android/blob/3fdfb6e230767138849edf858c13da1bf1d3f90b/lib/java/com/google/android/material/divider/MaterialDividerItemDecoration.java#L321
I used this divider in the last item with a dropdown. When the itemView is clicked then shows a textView from gone to visible state and it is working ok (the divider is not showed) but when the view collapses the textView (from visible to gone) then the childcount is increased one time and decreased very quick, showing and hiding the divider very fast.
Maybe using the itemCount from adapter and not the childCount could fix the problem. I tried this approach using a custom ItemDecorator overriding the onDrawOver and it is working, but i dont know if is the best solution.
Update: The blink appears when is called the method notifyItemChanged(pos, item)
Hi, we have to revert the change that closed this issue as it caused issues with lastItemDecorated=false not working in some cases. dividerCount is based on the number of items in the adapter, but the enumeration is based on the items that are directly inside RecyclerView, and this leads to incorrect behavior.
could you provide a sample app with the issue you were seeing so we can better investigate it and come up with a different solution?
Hi @leticiarossi I created this branch to execute the scenario to reproduce the bug, thanks! https://github.com/mnlmato/material-components-android/tree/bugfix/setup-show-blink-last-item-material-divider
The adapter class is ItemAdapterTest.java
@mnlmato, thank you for the sample provided. I'm glad to say this PR resolves your issue as well.
@pubiqq Happy to hear that, thanks :)