Update SpeakEngineDialog.kt
This commit is contained in:
@@ -236,16 +236,21 @@ class SpeakEngineDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_recycl
|
|||||||
adapter.notifyItemRangeChanged(adapter.getHeaderCount(), adapter.itemCount)
|
adapter.notifyItemRangeChanged(adapter.getHeaderCount(), adapter.itemCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【核心修改点】清理缓存方法
|
||||||
|
* 原来:只删除 cacheDir (内部存储)
|
||||||
|
* 现在:调用 AppConfig.clearTtsCache(),自动处理 externalCacheDir (外部存储)
|
||||||
|
*/
|
||||||
fun clearCache() {
|
fun clearCache() {
|
||||||
execute {
|
execute {
|
||||||
ReadAloud.upReadAloudClass()
|
ReadAloud.upReadAloudClass()
|
||||||
val ttsFolderPath = "${requireContext().cacheDir.absolutePath}${File.separator}httpTTS${File.separator}"
|
|
||||||
FileUtils.listDirsAndFiles(ttsFolderPath)?.forEach {
|
// 调用万能清理函数
|
||||||
FileUtils.delete(it.absolutePath)
|
AppConfig.clearTtsCache()
|
||||||
}
|
|
||||||
|
// 显示成功提示
|
||||||
toastOnUi(R.string.clear_cache_success)
|
toastOnUi(R.string.clear_cache_success)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class Adapter(context: Context) :
|
inner class Adapter(context: Context) :
|
||||||
@@ -301,4 +306,4 @@ class SpeakEngineDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_recycl
|
|||||||
fun upSpeakEngineSummary()
|
fun upSpeakEngineSummary()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user