clear coil memory cache when clearing non library covers

This commit is contained in:
Carlos 2021-07-05 12:43:15 -04:00 committed by Jays2Kings
parent 91498139da
commit 9ac99023d9
2 changed files with 4 additions and 3 deletions

View File

@ -99,8 +99,6 @@ class CoverCache(val context: Context) {
fun deleteAllCachedCovers() {
GlobalScope.launch(Dispatchers.IO) {
val directory = onlineCoverDirectory
val size = DiskUtil.getDirectorySize(directory)
var deletedSize = 0L
val files =
directory.listFiles()?.sortedBy { it.lastModified() }?.iterator() ?: return@launch
@ -117,7 +115,10 @@ class CoverCache(val context: Context) {
)
)
}
context.imageLoader.memoryCache.clear()
}
lastClean = System.currentTimeMillis()
}

View File

@ -19,7 +19,7 @@ class CoilSetup(context: Context) {
.allowHardware(false)
.componentRegistry {
if (Build.VERSION.SDK_INT >= 28) {
add(ImageDecoderDecoder())
add(ImageDecoderDecoder(context))
} else {
add(GifDecoder())
}