优化
This commit is contained in:
@@ -19,6 +19,7 @@ import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
|||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
import io.legado.app.help.http.okHttpClient
|
import io.legado.app.help.http.okHttpClient
|
||||||
import io.legado.app.utils.GSON
|
import io.legado.app.utils.GSON
|
||||||
|
import io.legado.app.utils.externalCache
|
||||||
import okhttp3.CacheControl
|
import okhttp3.CacheControl
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -114,7 +115,7 @@ object ExoPlayerHelper {
|
|||||||
val databaseProvider = StandaloneDatabaseProvider(appCtx)
|
val databaseProvider = StandaloneDatabaseProvider(appCtx)
|
||||||
return@lazy SimpleCache(
|
return@lazy SimpleCache(
|
||||||
//Exoplayer的缓存路径
|
//Exoplayer的缓存路径
|
||||||
File(appCtx.externalCacheDir, "exoplayer"),
|
File(appCtx.externalCache, "exoplayer"),
|
||||||
//100M的缓存
|
//100M的缓存
|
||||||
LeastRecentlyUsedCacheEvictor((100 * 1024 * 1024).toLong()),
|
LeastRecentlyUsedCacheEvictor((100 * 1024 * 1024).toLong()),
|
||||||
//记录缓存的数据库
|
//记录缓存的数据库
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import io.legado.app.utils.compress.ZipUtils
|
|||||||
import io.legado.app.utils.createFileIfNotExist
|
import io.legado.app.utils.createFileIfNotExist
|
||||||
import io.legado.app.utils.createFolderIfNotExist
|
import io.legado.app.utils.createFolderIfNotExist
|
||||||
import io.legado.app.utils.delete
|
import io.legado.app.utils.delete
|
||||||
|
import io.legado.app.utils.externalCache
|
||||||
import io.legado.app.utils.find
|
import io.legado.app.utils.find
|
||||||
import io.legado.app.utils.list
|
import io.legado.app.utils.list
|
||||||
import io.legado.app.utils.openInputStream
|
import io.legado.app.utils.openInputStream
|
||||||
@@ -164,7 +165,7 @@ class AboutFragment : PreferenceFragmentCompat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun copyLogs(doc: FileDoc) {
|
private fun copyLogs(doc: FileDoc) {
|
||||||
val cacheDir = appCtx.externalCacheDir
|
val cacheDir = appCtx.externalCache
|
||||||
val logFiles = File(cacheDir, "logs")
|
val logFiles = File(cacheDir, "logs")
|
||||||
val crashFiles = File(cacheDir, "crash")
|
val crashFiles = File(cacheDir, "crash")
|
||||||
val logcatFile = File(cacheDir, "logcat.txt")
|
val logcatFile = File(cacheDir, "logcat.txt")
|
||||||
@@ -186,7 +187,7 @@ class AboutFragment : PreferenceFragmentCompat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun copyHeapDump(doc: FileDoc): Boolean {
|
private fun copyHeapDump(doc: FileDoc): Boolean {
|
||||||
val heapFile = FileDoc.fromFile(File(appCtx.externalCacheDir, "heapDump")).list()
|
val heapFile = FileDoc.fromFile(File(appCtx.externalCache, "heapDump")).list()
|
||||||
?.firstOrNull() ?: return false
|
?.firstOrNull() ?: return false
|
||||||
doc.find("heapDump")?.delete()
|
doc.find("heapDump")?.delete()
|
||||||
val heapDumpDoc = doc.createFolderIfNotExist("heapDump")
|
val heapDumpDoc = doc.createFolderIfNotExist("heapDump")
|
||||||
|
|||||||
Reference in New Issue
Block a user