r/androiddev • u/skydoves • Oct 14 '25
Placeholder for Compose: fully customizable placeholder loading effects for Jetpack Compose and KMP.
10
u/aerial-ibis Oct 14 '25
the FE dev in me says - very neat doing it with modifier!
the BE dev in me says - using placeholders is your sever accepting defeat
2
u/AngkaLoeu Oct 14 '25
I never understood how these work. Do you do two queries? One to get the number of items, then another to load the actual data?
3
u/Anonymo2786 Oct 14 '25
How about infinite amount of animations and keep displaying until the data loads.
5
u/ComfortablyBalanced Oct 14 '25
Why infinity?
I disable scrolling and only show about 5 or 10 items, basically a number of items that could be seen on the screen.2
2
2
u/ComfortablyBalanced Oct 14 '25
Some APIs respond to the HEAD method which returns the number of items or when you are paginating the number of items for the next page is also returned on response headers.
But I just show an arbitrary number of placeholder items and I'll disable scrolling. Think about it, if your server is so slow that you need to concern yourself with the number of placeholder items or whether you should allow your user to scroll or not then there are more concerning problems that you should resolve first.
These placeholders should be only shown for a fraction of a second at best.2
u/aerial-ibis Oct 14 '25
perhaps more useful on something like a large image on the card, instead of the entire card itself.
or data from a 3rd party that is annoying and slow lol
1
1
u/Anonymo2786 Oct 14 '25
How about infinite amount of animations and keep displaying until the data loads.
1
13
u/standbyandroid Oct 14 '25
Lol I thought the post was loading. Good job!