From 9ac99023d9198320da3c64b8237e20f2edbee21b Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Mon, 5 Jul 2021 12:43:15 -0400 Subject: [PATCH] clear coil memory cache when clearing non library covers --- .../main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt | 5 +++-- .../java/eu/kanade/tachiyomi/data/image/coil/CoilSetup.kt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt index fce806ae87..d73f6c921c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt @@ -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() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/image/coil/CoilSetup.kt b/app/src/main/java/eu/kanade/tachiyomi/data/image/coil/CoilSetup.kt index a5dea33785..21769cb1f4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/image/coil/CoilSetup.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/image/coil/CoilSetup.kt @@ -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()) }