This commit is contained in:
Horis
2023-02-11 21:22:25 +08:00
parent f86f4fcb9c
commit b49730b3ef
11 changed files with 44 additions and 3 deletions
@@ -123,6 +123,7 @@ object PreferKey {
const val audioPlayWakeLock = "audioPlayWakeLock"
const val readAloudWakeLock = "readAloudWakeLock"
const val showLastUpdateTime = "showLastUpdateTime"
const val clearWebViewData = "clearWebViewData"
const val cPrimary = "colorPrimary"
const val cAccent = "colorAccent"
@@ -1,6 +1,7 @@
package io.legado.app.ui.config
import android.app.Application
import android.content.Context
import io.legado.app.R
import io.legado.app.base.BaseViewModel
import io.legado.app.help.AppWebDav
@@ -25,5 +26,13 @@ class ConfigViewModel(application: Application) : BaseViewModel(application) {
}
}
fun clearWebViewData() {
execute {
FileUtils.delete(context.getDir("webview", Context.MODE_PRIVATE))
}.onSuccess {
context.toastOnUi(R.string.success)
}
}
}
}
@@ -2,6 +2,7 @@ package io.legado.app.ui.config
import android.annotation.SuppressLint
import android.content.ComponentName
import android.content.Context
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.os.Bundle
@@ -131,6 +132,7 @@ class OtherConfigFragment : PreferenceFragment(),
AppConfig.sourceEditMaxLine = it
}
}
PreferKey.clearWebViewData -> clearWebViewData()
}
return super.onPreferenceTreeClick(preference)
}
@@ -230,6 +232,15 @@ class OtherConfigFragment : PreferenceFragment(),
}
}
private fun clearWebViewData() {
alert(R.string.clear_webview_data, R.string.sure_del) {
okButton {
viewModel.clearWebViewData()
}
noButton()
}
}
private fun isProcessTextEnabled(): Boolean {
return packageManager.getComponentEnabledSetting(componentName) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
}