From f65411e3eafc29ac3ecf1a0ba51a252a2111e46a Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 15 Dec 2019 13:47:45 +0800 Subject: [PATCH 1/5] fix the bug about book cache --- app/src/main/java/io/legado/app/help/BookHelp.kt | 11 ++++++++++- .../java/io/legado/app/ui/config/ConfigFragment.kt | 6 +----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index 022113231..e6f17134a 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -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 { diff --git a/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt index 0410b34a6..74d517b20 100644 --- a/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt @@ -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) } } From 880e9e51acc0ff3aa575fe11cf123715591cd567 Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 15 Dec 2019 14:21:35 +0800 Subject: [PATCH 2/5] up --- app/src/main/java/io/legado/app/ui/about/AboutFragment.kt | 1 + app/src/main/res/values/pref_key_value.xml | 3 ++- app/src/main/res/xml/about.xml | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt index 117ef37c6..303b97e19 100644 --- a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt @@ -23,6 +23,7 @@ class AboutFragment : PreferenceFragmentCompat() { override fun onPreferenceTreeClick(preference: Preference?): Boolean { when (preference?.key) { + "contributors" -> openIntent(Intent.ACTION_VIEW, getString(R.string.this_github_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") diff --git a/app/src/main/res/values/pref_key_value.xml b/app/src/main/res/values/pref_key_value.xml index 138aa68cf..8df6bde2a 100644 --- a/app/src/main/res/values/pref_key_value.xml +++ b/app/src/main/res/values/pref_key_value.xml @@ -18,8 +18,9 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.2357.134 Safari/537.36 - https://gedoor.github.io/MyBookshelf/sourcerule.html + https://gitee.com/alanskycn/yuedu/blob/master/Rule/README.md https://github.com/gedoor/legado + https://github.com/gedoor/legado/graphs/contributors https://gedoor.github.io/MyBookshelf/disclaimer.html https://gedoor.github.io/MyBookshelf/ https://github.com/gedoor/legado/releases/latest diff --git a/app/src/main/res/xml/about.xml b/app/src/main/res/xml/about.xml index 9bf6b7b71..ff8e16c44 100644 --- a/app/src/main/res/xml/about.xml +++ b/app/src/main/res/xml/about.xml @@ -3,9 +3,9 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> Date: Sun, 15 Dec 2019 14:23:50 +0800 Subject: [PATCH 3/5] up --- app/src/main/java/io/legado/app/ui/about/AboutFragment.kt | 2 +- app/src/main/res/values/pref_key_value.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt index 303b97e19..08a5fa6a1 100644 --- a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt @@ -23,7 +23,7 @@ class AboutFragment : PreferenceFragmentCompat() { override fun onPreferenceTreeClick(preference: Preference?): Boolean { when (preference?.key) { - "contributors" -> openIntent(Intent.ACTION_VIEW, getString(R.string.this_github_url)) + "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") diff --git a/app/src/main/res/values/pref_key_value.xml b/app/src/main/res/values/pref_key_value.xml index 8df6bde2a..71c26bc29 100644 --- a/app/src/main/res/values/pref_key_value.xml +++ b/app/src/main/res/values/pref_key_value.xml @@ -20,7 +20,7 @@ https://gitee.com/alanskycn/yuedu/blob/master/Rule/README.md https://github.com/gedoor/legado - https://github.com/gedoor/legado/graphs/contributors + https://github.com/gedoor/legado/graphs/contributors https://gedoor.github.io/MyBookshelf/disclaimer.html https://gedoor.github.io/MyBookshelf/ https://github.com/gedoor/legado/releases/latest From 5a4dce5bf651347e1fa5390c18cc5aad4994c430 Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 15 Dec 2019 14:34:01 +0800 Subject: [PATCH 4/5] up --- app/src/main/assets/updateLog.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index a669fb6a6..d424bc6cb 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -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]优化老版本规则导入 \ No newline at end of file +* 优化老版本规则导入from Celeter \ No newline at end of file From 109212c98e9f90a829f9eb2a5d9adb60a6539a79 Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 15 Dec 2019 15:09:18 +0800 Subject: [PATCH 5/5] up --- app/src/main/res/xml/pref_config.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/xml/pref_config.xml b/app/src/main/res/xml/pref_config.xml index bc421509b..55f0f6021 100644 --- a/app/src/main/res/xml/pref_config.xml +++ b/app/src/main/res/xml/pref_config.xml @@ -29,16 +29,17 @@ android:title="文字操作显示搜索" app:iconSpaceReserved="false" /> - - + + +