Merge pull request #53 from ca1e/master

commit clean caches
pull/54/head
kunfei 5 years ago committed by GitHub
commit 4b22cbc437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/src/main/assets/readConfig.json
  2. 3
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  3. 10
      app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt
  4. 1
      app/src/main/res/values/strings.xml
  5. 2
      app/src/main/res/xml/about.xml
  6. 4
      app/src/main/res/xml/pref_config.xml

@ -4,7 +4,7 @@
"bgType": 1, "bgType": 1,
"darkStatusIcon": true, "darkStatusIcon": true,
"textColor": "#5E432E", "textColor": "#5E432E",
"textSize": 22, "textSize": 24,
"letterSpacing": 0, "letterSpacing": 0,
"lineSpacingExtra": 10, "lineSpacingExtra": 10,
"lineSpacingMultiplier": 1.2, "lineSpacingMultiplier": 1.2,
@ -14,11 +14,11 @@
"paddingBottom": 0 "paddingBottom": 0
}, },
{ {
"bgStr": "新羊皮纸.jpg", "bgStr": "#C6BAA1",
"bgType": 1, "bgType": 0,
"darkStatusIcon": true, "darkStatusIcon": true,
"textColor": "#5E432E", "textColor": "#5E432E",
"textSize": 22, "textSize": 24,
"letterSpacing": 0, "letterSpacing": 0,
"lineSpacingExtra": 10, "lineSpacingExtra": 10,
"lineSpacingMultiplier": 1.2, "lineSpacingMultiplier": 1.2,
@ -32,7 +32,7 @@
"bgType": 0, "bgType": 0,
"darkStatusIcon": false, "darkStatusIcon": false,
"textColor": "#FFFFFF", "textColor": "#FFFFFF",
"textSize": 22, "textSize": 24,
"letterSpacing": 0, "letterSpacing": 0,
"lineSpacingExtra": 10, "lineSpacingExtra": 10,
"lineSpacingMultiplier": 1.2, "lineSpacingMultiplier": 1.2,
@ -46,7 +46,7 @@
"bgType": 1, "bgType": 1,
"darkStatusIcon": false, "darkStatusIcon": false,
"textColor": "#adadad", "textColor": "#adadad",
"textSize": 22, "textSize": 24,
"letterSpacing": 0, "letterSpacing": 0,
"lineSpacingExtra": 10, "lineSpacingExtra": 10,
"lineSpacingMultiplier": 1.2, "lineSpacingMultiplier": 1.2,
@ -60,7 +60,7 @@
"bgType": 0, "bgType": 0,
"darkStatusIcon": false, "darkStatusIcon": false,
"textColor": "#adadad", "textColor": "#adadad",
"textSize": 22, "textSize": 24,
"letterSpacing": 0, "letterSpacing": 0,
"lineSpacingExtra": 10, "lineSpacingExtra": 10,
"lineSpacingMultiplier": 1.2, "lineSpacingMultiplier": 1.2,

@ -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>

@ -5,7 +5,7 @@
<androidx.preference.Preference <androidx.preference.Preference
android:key="isNightTheme" android:key="isNightTheme"
android:title="开发人员" android:title="开发人员"
android:summary="gedoor, Invinciblelee, atbest, Antecer, mabDc" android:summary="gedoor, Invinciblelee, atbest, Antecer, mabDc, Ca1e"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<androidx.preference.Preference <androidx.preference.Preference

@ -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