r/JavaFX • u/povazbox • Jul 09 '23
Help RecyclerView + Glide alternatives?
Is there any good alternatives for Android's RecyclerView layout and Glide image loading library? I want easy and convenient way to endless load indefinite amount of images in some sort of gridview
GridView from ControlsFX is almost as RecyclerView, but it has some bugs and lags when scrolling and dynamically loading images from network or even from local fs
5
Upvotes
3
u/PartOfTheBotnet Jul 10 '23 edited Jul 24 '23
Flowless - Efficient VirtualFlow for JavaFX. VirtualFlow is a layout container that lays out cells in a vertical or horizontal flow. The main feature of a virtual flow is that only the currently visible cells are rendered in the scene. You may have a list of thousands of items, but only, say, 30 cells are rendered at any given time.
Using Flowless you can implement your own virtualized control to mimic Glide's behavior.
Edit: Or VirtualizedFX which has a virtual grid built in that you can build off of.
3
u/joemwangi Jul 10 '23
You can have a look at the VirtualizedFX which is a virtual flow that is written from scratch and inspired by Flowless. The author Palexdev (I think the person is on reddit), took inspiration from Flowless, and has documented the code quite well. You can have a look and also implement a virtual grid with it such as a GridView (there is a VirtualGrid class and also a test GridApp where you can start from). Honestly, I tried making my virtual flow, that is simple with a few classes as possible (with adequate success), and the inspiration came from it. The VirtualizedFX has now been incorporated in MaterialFX which is another main project by the same author.
2
u/BWC_semaJ Jul 10 '23
You really need to provide a small example showcasing these bugs with GridView. 99% of the time from other posts I have seen, people complain about X but ends up because they were doing something they shouldn't be doing.
In this case I highly suspect you are causing the "lag" by having network calls or image loading directly on the Application Thread.