Merge pull request #59 from Celeter/master

fix the bug about book cache
pull/60/head
kunfei 5 years ago committed by GitHub
commit 7b9d66dd78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      app/src/main/assets/updateLog.md
  2. 11
      app/src/main/java/io/legado/app/help/BookHelp.kt
  3. 1
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt
  4. 6
      app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt
  5. 3
      app/src/main/res/values/pref_key_value.xml
  6. 4
      app/src/main/res/xml/about.xml
  7. 11
      app/src/main/res/xml/pref_config.xml

@ -1,8 +1,11 @@
## 更新日志
* 旧版数据导入教程:
* 先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】,提示存储权限,选择允许即可导入成功。
* 注意:由于安卓10更改了权限策略,还需要给「允许安装其他应用」的权限才能导入源。
* 先在旧版阅读2.19进行备份,再在新版阅读3.0的【我的】中,点击【备份与恢复】,选择【导入旧版本数据】,提示需要存储权限,选择允许即可导入成功。
* 注意:由于安卓10更改了权限策略,还需要给「允许安装其他应用」的权限才能导入源。MIUI11也需要此权限。
**2019/12/15**
* 修复清理缓存会把其他文件删除的问题
**2019/12/12**
* [fix]web服务停止问题
@ -14,14 +17,16 @@
* [mod]启用web服务
**2019/12/03**
* [by Celeter]1、调试log修改 2、增加书源字符串分享(RSS未包含) 3、增加导出选中的源(包含书源、RSS、替换规则)
* from Celeter:
- 调试log修改
- 增加书源字符串分享(RSS未包含)
- 增加导出选中的源(包含书源、RSS、替换规则)
* 一键缓存
* 修复bug
**2019/12/02**
* 修复一些bug,书架网格布局完成
* 音频添加速度调整
* 后台朗读,长按返回,或点击按钮
* 订阅可以隐藏
* [by Celeter]优化老版本规则导入
* 优化老版本规则导入from Celeter

@ -26,6 +26,15 @@ object BookHelp {
?: App.INSTANCE.cacheDir.absolutePath
}
private fun getBookCachePath(): String {
return "$downloadPath${File.separator}book_cache"
}
fun clearCache() {
FileHelp.deleteFile(getBookCachePath())
FileHelp.getFolder(getBookCachePath())
}
fun saveContent(book: Book, bookChapter: BookChapter, content: String) {
if (content.isEmpty()) return
val filePath = getChapterPath(book, bookChapter)
@ -69,7 +78,7 @@ object BookHelp {
val bookFolder = formatFolderName(book.name + book.bookUrl)
val chapterFile =
String.format("%05d-%s", bookChapter.index, MD5Utils.md5Encode(bookChapter.title))
return "$downloadPath${File.separator}book_cache${File.separator}$bookFolder${File.separator}$chapterFile.nb"
return "${getBookCachePath()}${File.separator}$bookFolder${File.separator}$chapterFile.nb"
}
private fun formatFolderName(folderName: String): String {

@ -23,6 +23,7 @@ class AboutFragment : PreferenceFragmentCompat() {
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
when (preference?.key) {
"contributors" -> openIntent(Intent.ACTION_VIEW, getString(R.string.contributors_url))
"update_log" -> UpdateLog().show(childFragmentManager, "update_log")
"check_update" -> openIntent(Intent.ACTION_VIEW, getString(R.string.latest_release_url))
"mail" -> openIntent(Intent.ACTION_SENDTO, "mailto:kunfei.ge@gmail.com")

@ -13,7 +13,6 @@ import io.legado.app.R
import io.legado.app.constant.Bus
import io.legado.app.constant.PreferKey
import io.legado.app.help.BookHelp
import io.legado.app.help.FileHelp
import io.legado.app.lib.theme.ATH
import io.legado.app.receiver.SharedReceiverActivity
import io.legado.app.ui.filechooser.FileChooserDialog
@ -62,10 +61,7 @@ class ConfigFragment : PreferenceFragmentCompat(),
initPath = getPreferenceString(PreferKey.downloadPath)
)
PreferKey.cleanCache -> {
getPreferenceString(PreferKey.downloadPath).let {
FileHelp.deleteFile(it)
FileHelp.getFolder(it)
}
BookHelp.clearCache()
toast(R.string.clear_cache_success)
}
}

@ -18,8 +18,9 @@
<string name="pv_user_agent">Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.2357.134 Safari/537.36</string>
<string name="source_rule_url">https://gedoor.github.io/MyBookshelf/sourcerule.html</string>
<string name="source_rule_url">https://gitee.com/alanskycn/yuedu/blob/master/Rule/README.md</string>
<string name="this_github_url">https://github.com/gedoor/legado</string>
<string name="contributors_url">https://github.com/gedoor/legado/graphs/contributors</string>
<string name="disclaimer_url">https://gedoor.github.io/MyBookshelf/disclaimer.html</string>
<string name="home_page_url">https://gedoor.github.io/MyBookshelf/</string>
<string name="latest_release_url">https://github.com/gedoor/legado/releases/latest</string>

@ -3,9 +3,9 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.Preference
android:key="isNightTheme"
android:key="contributors"
android:title="开发人员"
android:summary="gedoor, Invinciblelee, atbest, Antecer, mabDc, Ca1e"
android:summary="gedoor,Invinciblelee等, 详情请在github中查看"
app:iconSpaceReserved="false" />
<androidx.preference.Preference

@ -29,16 +29,17 @@
android:title="文字操作显示搜索"
app:iconSpaceReserved="false" />
<Preference
android:key="downloadPath"
android:title="@string/download_path"
app:iconSpaceReserved="false" />
<io.legado.app.lib.theme.prefs.ATESwitchPreference
android:defaultValue="false"
android:key="recordLog"
android:title="记录日志"
app:iconSpaceReserved="false" />
<Preference
android:key="downloadPath"
android:title="@string/download_path"
app:iconSpaceReserved="false" />
<Preference
android:key="cleanCache"
android:title="@string/cleancache"

Loading…
Cancel
Save