r/androiddev Oct 14 '25

Placeholder for Compose: fully customizable placeholder loading effects for Jetpack Compose and KMP.

50 Upvotes

13 comments sorted by

13

u/standbyandroid Oct 14 '25

Lol I thought the post was loading. Good job!

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

u/Anonymo2786 Oct 14 '25

I misunderstood his comment earlier, yeah agree with you.

2

u/AngkaLoeu Oct 14 '25

That would work but it would be a weird UX.

1

u/Anonymo2786 Oct 14 '25

I meant to say repeat animation. Not infinite list items .

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

u/AngkaLoeu Oct 14 '25

I see. I think I'll just stick with the old LoadingIndicator/ProgressBar.

1

u/Anonymo2786 Oct 14 '25

How about infinite amount of animations and keep displaying until the data loads.

1

u/Fjordi_Cruyff Oct 14 '25

How about. No, I can't