ARK-Builders / ARK-Navigator

Android app for navigation through your data
MIT License
15 stars 15 forks source link

Resource modification is not detected #152

Closed kirillt closed 2 years ago

kirillt commented 2 years ago

https://user-images.githubusercontent.com/581023/145065132-2e5e8a69-5ddd-4d6f-b1b0-be432da95278.mp4

How to reproduce (example with images):

Expected behaviour:

Actual behaviour:

Apparently, re-indexing doesn't trigger although it should be triggered because path of the image has updated last modified. So, the id isn't re-calculated and both preview and thumbnail aren't re-generated.

cnzqa commented 2 years ago

Checked on Andorid 10, same behavior. Build no: 181

kirillt commented 2 years ago

Dinar has discovered that the issue originates from Glide's cache.

Active resources - Is this image displayed in another View right now? Memory cache - Was this image recently loaded and still in memory? Resource - Has this image been decoded, transformed, and written to the disk cache before? Data - Was the data this image was obtained from written to the disk cache before?

In fact, the cache keys for steps 1-3 (Active resources, memory cache, resource disk cache) also include a number of other pieces of data including: The width and height The optional Transformation Any added Options The requested data type (Bitmap, GIF, etc)

mdrlzy commented 2 years ago

Possible solution is to add custom image signature for glide cache validation. https://bumptech.github.io/glide/doc/caching.html#custom-cache-invalidation

kirillt commented 2 years ago

@mdrlzy this looks good, I think ResourceId should be enough as signature. It's interesting though, why the caches are not invalidated when image size is changed.

kirillt commented 2 years ago

Closed by #201