Faltenreich / SkeletonLayout

Skeleton view pattern for Android
Apache License 2.0
496 stars 65 forks source link

Support auto skeleton item size calculation. #16

Open puppywang opened 4 years ago

puppywang commented 4 years ago

In our real app usage, we would like not to supply the skeleton item size in RecyclerView.applySkeleton, we want it automatically calculated, so I create this simple PR, please check, thanks.

Faltenreich commented 4 years ago

Hi @puppywang, thank you for your contribution!

This improvement makes absolute sense and I will gladly add it to the library. Sadly your pull request does not work as expected yet. The demo app shows only one item at a time in its Skeleton as opposed to the three items that would have place. Maybe you can test this by yourself and improve your pull request.

Precondition: Set the skeletonItemSize of the RecyclerViewFragment to 0 in order to autocalculate the item count with your logic.

Thanks in advance and have a nice day!

puppywang commented 4 years ago

Got, I will try to fix it ASAP.