commit clean caches

pull/53/head
ca1e 5 years ago
parent 341ddaaf62
commit f4ff991e1d
  1. 3
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 10
      app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt
  3. 1
      app/src/main/res/values/strings.xml
  4. 4
      app/src/main/res/xml/pref_config.xml

@ -10,4 +10,7 @@ object PreferKey {
const val nextKey = "nextKeyCode" const val nextKey = "nextKeyCode"
const val showRss = "showRss" const val showRss = "showRss"
const val bookshelfLayout = "bookshelfLayout" const val bookshelfLayout = "bookshelfLayout"
const val recordLog = "recordLog"
const val processText = "process_text"
const val cleanCache = "cleanCache"
} }

@ -12,6 +12,7 @@ import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.help.BookHelp import io.legado.app.help.BookHelp
import io.legado.app.help.FileHelp
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.receiver.SharedReceiverActivity import io.legado.app.receiver.SharedReceiverActivity
import io.legado.app.ui.filechooser.FileChooserDialog import io.legado.app.ui.filechooser.FileChooserDialog
@ -59,6 +60,11 @@ class ConfigFragment : PreferenceFragmentCompat(),
mode = FileChooserDialog.DIRECTORY, mode = FileChooserDialog.DIRECTORY,
initPath = getPreferenceString(PreferKey.downloadPath) initPath = getPreferenceString(PreferKey.downloadPath)
) )
PreferKey.cleanCache -> {
LogUtils.d("xxx","cleancaches")
FileHelp.deleteFile(getPreferenceString(PreferKey.downloadPath))
toast("成功清理缓存")
}
} }
return super.onPreferenceTreeClick(preference) return super.onPreferenceTreeClick(preference)
} }
@ -69,8 +75,8 @@ class ConfigFragment : PreferenceFragmentCompat(),
BookHelp.upDownloadPath() BookHelp.upDownloadPath()
findPreference<Preference>(key)?.summary = getPreferenceString(key) findPreference<Preference>(key)?.summary = getPreferenceString(key)
} }
"recordLog" -> LogUtils.upLevel() PreferKey.recordLog -> LogUtils.upLevel()
"process_text" -> sharedPreferences?.let { PreferKey.processText -> sharedPreferences?.let {
setProcessTextEnable(it.getBoolean("process_text", true)) setProcessTextEnable(it.getBoolean("process_text", true))
} }
PreferKey.showRss -> postEvent(PreferKey.showRss, PreferKey.showRss) PreferKey.showRss -> postEvent(PreferKey.showRss, PreferKey.showRss)

@ -313,6 +313,7 @@
<string name="use_to">替换范围,选填书名或者源名</string> <string name="use_to">替换范围,选填书名或者源名</string>
<string name="menu_action_group">分组</string> <string name="menu_action_group">分组</string>
<string name="download_path">内容缓存路径</string> <string name="download_path">内容缓存路径</string>
<string name="cleancache">清理缓存</string>
<string name="sys_file_picker">系统文件选择器</string> <string name="sys_file_picker">系统文件选择器</string>
<string name="new_version">新版本</string> <string name="new_version">新版本</string>
<string name="download_update">下载更新</string> <string name="download_update">下载更新</string>

@ -39,4 +39,8 @@
android:key="recordLog" android:key="recordLog"
android:title="记录日志" android:title="记录日志"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<Preference
android:key="cleanCache"
android:title="@string/cleancache"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>
Loading…
Cancel
Save