|
@@ -27,6 +27,8 @@ import io.legado.app.utils.StringUtils
|
|
|
import io.legado.app.utils.fromJsonObject
|
|
import io.legado.app.utils.fromJsonObject
|
|
|
import io.legado.app.utils.postEvent
|
|
import io.legado.app.utils.postEvent
|
|
|
import io.legado.app.utils.showDialogFragment
|
|
import io.legado.app.utils.showDialogFragment
|
|
|
|
|
+// 【新增引用】为了显示清理成功的提示
|
|
|
|
|
+import io.legado.app.utils.toastOnUi
|
|
|
|
|
|
|
|
class ReadAloudConfigDialog : BasePrefDialogFragment() {
|
|
class ReadAloudConfigDialog : BasePrefDialogFragment() {
|
|
|
private val readAloudPreferTag = "readAloudPreferTag"
|
|
private val readAloudPreferTag = "readAloudPreferTag"
|
|
@@ -74,6 +76,18 @@ class ReadAloudConfigDialog : BasePrefDialogFragment() {
|
|
|
findPreference<SwitchPreference>(PreferKey.pauseReadAloudWhilePhoneCalls)?.let {
|
|
findPreference<SwitchPreference>(PreferKey.pauseReadAloudWhilePhoneCalls)?.let {
|
|
|
it.isEnabled = AppConfig.ignoreAudioFocus
|
|
it.isEnabled = AppConfig.ignoreAudioFocus
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 【新增代码】绑定清理缓存按钮事件
|
|
|
|
|
+ findPreference<Preference>("clear_cache")?.let {
|
|
|
|
|
+ it.summary = getString(R.string.clear_cache)
|
|
|
|
|
+ it.setOnPreferenceClickListener {
|
|
|
|
|
+ // 调用 AppConfig 中的万能清理函数 (自动处理外部存储)
|
|
|
|
|
+ AppConfig.clearTtsCache()
|
|
|
|
|
+ // 弹出提示
|
|
|
|
|
+ toastOnUi("音频缓存已清理")
|
|
|
|
|
+ true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
@@ -138,4 +152,4 @@ class ReadAloudConfigDialog : BasePrefDialogFragment() {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|