优化
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user