Open Faltenreich opened 5 years ago
I've made updates to the library to support this and am working on a callback to allow the user to have a say in which views are skeleton-ized. A few questions before I submit a pull request: 1) I think a view based on ConstraintLayout instead of or in addition to FrameLayout would be helpful in reducing the number of views in the view hierarchy. And another option to a callback architecture would be to add an attribute to child views to tag which views should be used for the skeleton. 2) I think a delay to showSkeleton() as a parameter would be a good addition for the cases when showOriginal() happens quickly (e.g., short delay due to cache hit as an example).
What are your thoughts?
Hello @KennyGoers, thank you for your investment and the interesting feedback. I am not sure if I understand your suggestions correctly, so I will address both of them in the following:
Sorry for my late response.
By deriving from ConstraintLayout (or others) there would not be a need for the extra layout, for example, I currently wrap a SkeletonLayout around a ConstrainLayout I'm trying to "skeletonize" if it was derived from ConstraintLayout directly I wouldn't have to have two layers. Understand?
When I call skeleton view to show the skeleton and the call I make to fetch data returns immediately or quickly the skeleton flashes in quickly and returns to a data view. Since the transition is so quick it seems distracting more that useful, so a delay would leave the view blank if it was a very quick showSkeleton/showOriginal cycle.
showOriginal() and showSkeleton() do not respect the original visibility of the masked views. The original visibility should be cached in order to return to the original state on calling showOriginal().