Skip to content

Commit

Permalink
perf: imageCacheDir
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Nov 8, 2023
1 parent d32f55a commit 1c7df7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 8 additions & 1 deletion app/src/main/java/li/songe/gkd/util/FolderExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ private val cacheDir by lazy {
val snapshotZipDir by lazy { cacheDir.resolve("snapshotZip") }
val newVersionApkDir by lazy { cacheDir.resolve("newVersionApk") }
val logZipDir by lazy { cacheDir.resolve("logZip") }
val imageCacheDir by lazy { cacheDir.resolve("imageCache") }

fun initFolder() {
listOf(
dbFolder, subsFolder, snapshotFolder, snapshotZipDir, newVersionApkDir, logZipDir
dbFolder,
subsFolder,
snapshotFolder,
snapshotZipDir,
newVersionApkDir,
logZipDir,
imageCacheDir
).forEach { f ->
if (!f.exists()) {
f.mkdirs()
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/li/songe/gkd/util/Singleton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ object Singleton {
add(GifDecoder.Factory())
}
}.diskCache {
app.filesDir
app.getExternalFilesDir(null)
DiskCache.Builder()
.directory((app.externalCacheDir ?: app.cacheDir).resolve("imageCache")).build()
DiskCache.Builder().directory(imageCacheDir).build()
}.build()
}

Expand Down

0 comments on commit 1c7df7e

Please sign in to comment.