Open vibin opened 8 years ago
Thanks for the suggestion :) will update soon
Commit fc9a4e8 optimises album loading. Earlier logic was to check if image existed and then check if it belonged to a unique album. Presently, album ids are also queried, and first check is performed to see if it is an unique album id. If unique, then check if image existed.
The library is really slow on phones with photos in thousands (not very unusual!). After digging a bit into the Content Resolver code, I found the culprit. It's the
ArrayList.contains()
you're doing for each content row, for checking if to add a new album into the ArrayList.This can be done in a simpler, efficient way, by passing MediaStore.Images.Media.BUCKET_ID for orderBy of Cursor, and then just comparing adjacent IDs instead, to know if it's a new album.
FishBun does it this way and it works great. https://github.com/sangcomz/FishBun/blob/master/FishBun/src/main/java/com/sangcomz/fishbun/ui/album/AlbumActivity.java#L163
Thanks for the nice library!