h6ah4i / android-advancedrecyclerview

RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)
https://advancedrecyclerview.h6ah4i.com/
Apache License 2.0
5.32k stars 860 forks source link

Empty space on expand #354

Open rok5ek opened 7 years ago

rok5ek commented 7 years ago

I have an issue where i would like to fill the expanded space with a custom color or gradient in that matter. However RecyclerView works in a way that it expands the rows by leaving an empty space between items which results in seeing a white background (screenshot) or whatever is the background color. The empty space gets filled after the expansion animation, where onBindViewHolder gets called.

Could this be solved somehow, where I could fill this empty space with a custom view, so it gets epxanded nicely without color flickering?

Is there a way I could attach a listener to the animation and overlay it with a virtual view for that time?

Right before the child views are shown expansion_empty

After the child views are shown (group is expanded) expansion_full

h6ah4i commented 7 years ago

Maybe, ItemDecoration can handle that. I'll give it a try.

rok5ek commented 7 years ago

@h6ah4i That would mean a ton if it would work with decorators, but it doubt it :/

h6ah4i commented 7 years ago

@rok5ek Hi. Try the following branch code 😄

https://github.com/h6ah4i/android-advancedrecyclerview/commit/14ae11a66bbb6da0e27e937c05b328282d94c129

rok5ek commented 7 years ago

@h6ah4i Wow im impressed :+1: awesome piece of code. It works perfectly, even with the progress alpha, great! :wink:

Thank you again!

jintoga commented 6 years ago

Hello. I'm having the same problem. The difference is i want to achieve this behavior on a RecyclerView which uses HeaderFooterAdapter and ExpandableAdapter. I've already tried class FillExpandingAnimationGapDecoration but it seems like it only works for RecyclerView with single ExpandableAdapter. Any suggestions? Thanks!