增加是否自动清除过期搜索数据配置

pull/441/head
gedoor 4 years ago
parent e4dde5cced
commit cdbfe6d1b0
  1. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 7
      app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt
  3. 2
      app/src/main/res/values-zh-rHK/strings.xml
  4. 2
      app/src/main/res/values-zh-rTW/strings.xml
  5. 2
      app/src/main/res/values-zh/strings.xml
  6. 2
      app/src/main/res/values/strings.xml
  7. 16
      app/src/main/res/xml/pref_config_other.xml

@ -51,6 +51,7 @@ object PreferKey {
const val defaultCover = "defaultCover" const val defaultCover = "defaultCover"
const val replaceEnableDefault = "replaceEnableDefault" const val replaceEnableDefault = "replaceEnableDefault"
const val showBrightnessView = "showBrightnessView" const val showBrightnessView = "showBrightnessView"
const val autoClearExpired = "autoClearExpired"
const val cPrimary = "colorPrimary" const val cPrimary = "colorPrimary"
const val cAccent = "colorAccent" const val cAccent = "colorAccent"

@ -6,6 +6,7 @@ import com.hankcs.hanlp.HanLP
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.constant.PreferKey
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.storage.SyncBookProgress import io.legado.app.help.storage.SyncBookProgress
@ -33,8 +34,10 @@ open class WelcomeActivity : BaseActivity(R.layout.activity_welcome) {
private fun init() { private fun init() {
Coroutine.async { Coroutine.async {
//清除过期数据 //清除过期数据
App.db.searchBookDao() if (getPrefBoolean(PreferKey.autoClearExpired, true)) {
.clearExpired(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1)) App.db.searchBookDao()
.clearExpired(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1))
}
//初始化简繁转换引擎 //初始化简繁转换引擎
when (AppConfig.chineseConverterType) { when (AppConfig.chineseConverterType) {
1 -> HanLP.convertToSimplifiedChinese("初始化") 1 -> HanLP.convertToSimplifiedChinese("初始化")

@ -771,5 +771,7 @@
<string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string> <string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string>
<string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string> <string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string>
<string name="theme_name">主题名称</string> <string name="theme_name">主题名称</string>
<string name="auto_clear_expired">自动清除过期搜索数据</string>
<string name="auto_clear_expired_summary">超过一天的搜索数据</string>
</resources> </resources>

@ -771,5 +771,7 @@
<string name="explore_empty">目前沒有發現源,關注公眾號[开源阅读]添加包含發現的書源!</string> <string name="explore_empty">目前沒有發現源,關注公眾號[开源阅读]添加包含發現的書源!</string>
<string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string> <string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string>
<string name="theme_name">主题名称</string> <string name="theme_name">主题名称</string>
<string name="auto_clear_expired">自动清除过期搜索数据</string>
<string name="auto_clear_expired_summary">超过一天的搜索数据</string>
</resources> </resources>

@ -774,5 +774,7 @@
<string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string> <string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string>
<string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string> <string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string>
<string name="theme_name">主题名称</string> <string name="theme_name">主题名称</string>
<string name="auto_clear_expired">自动清除过期搜索数据</string>
<string name="auto_clear_expired_summary">超过一天的搜索数据</string>
</resources> </resources>

@ -777,5 +777,7 @@
<string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string> <string name="explore_empty">当前没有发现源,关注公众号[开源阅读]添加带发现的书源!</string>
<string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string> <string name="page_key_set_help">将焦点放到输入框按下物理按键会自动录入键值,多个按键会自动用英文逗号隔开.</string>
<string name="theme_name">主题名称</string> <string name="theme_name">主题名称</string>
<string name="auto_clear_expired">自动清除过期搜索数据</string>
<string name="auto_clear_expired_summary">超过一天的搜索数据</string>
</resources> </resources>

@ -58,11 +58,6 @@
android:summary="@string/replace_enable_default_s" android:summary="@string/replace_enable_default_s"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.Preference
android:key="threadCount"
android:title="@string/threads_num_title"
app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="mediaButtonOnExit" android:key="mediaButtonOnExit"
@ -70,6 +65,12 @@
android:summary="@string/media_button_on_exit_summary" android:summary="@string/media_button_on_exit_summary"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="true"
android:key="autoClearExpired"
android:title="@string/auto_clear_expired"
android:summary="@string/auto_clear_expired_summary" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="webPort" android:key="webPort"
android:title="@string/web_port_title" android:title="@string/web_port_title"
@ -81,6 +82,11 @@
android:summary="@string/clear_cache_summary" android:summary="@string/clear_cache_summary"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.Preference
android:key="threadCount"
android:title="@string/threads_num_title"
app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="process_text" android:key="process_text"

Loading…
Cancel
Save