We can’t preload the list in compose so situations...
# compose
a
We can’t preload the list in compose so situations like Image grid UX is not good. Does anyone have a workaround around this?
c
Could you elaborate on “image grid UX is not good”? We have LazyVerticalGrid now and you can use libraries to have placeholders for image loading. Do you have an example of what you need / want?
a
Yes, I'm using that component. Basically getting user complaints that they cannot see the images immediately when you scroll, you have to scroll slowly to make sure it doesn't exceed the image you're looking for. Does that make sense? When using scrollbars, it's fine to show placeholders because there's no way to preload and predict where the user is going to (date sections are useful here), but for normal scrolling, user has to wait a bit for every scrolled page.
c
Are the images being loaded from the network? Or is it scrolling jank? Do you have a video of this issue?
a
Thanks for asking. I can’t show my project, but for the purposes of illustration I hacked around my personal app which also loads the device gallery (I’m censoring my personal images with colors). Performance is really bad in my app for whatever reason though. It’s basically this but a lot faster (but still perceptively slow). Does this help? (Any maybe you have idea where this Jank is coming from… I’m using Paging and Coil here.)
And it's not limited to grid use cases. I also have a vertical pager like TikTok. If it only starts loading when I scroll, then you see this blacks while the player is loading. Unlike with ViewPagers where I can preload the adjacent items.
c
Hmm these do seem slow. Have you seen the same issues on a release build?
On the preloading adjacent items, are you using the Pager from Accompanist? ccing @Andrey Kulikov as well who might have more tips
If you can share the code of these examples also, that would be helpful for troubleshooting
Also, if you haven’t already reviewed this, it’s a useful start. We released it recently: https://developer.android.com/jetpack/compose/performance
👍 1
a
Have you seen the same issues on a release build?
This is release build 😅
are you using the Pager from Accompanist
VerticalPager on the second demo. Kind of make sense because it’s loading ExoPlayer which takes time
If you can share the code of these examples also, that would be helpful for troubleshooting
I’ll see what I can share.
255 Views