From f65411e3eafc29ac3ecf1a0ba51a252a2111e46a Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 15 Dec 2019 13:47:45 +0800 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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" /> - - + + + Date: Sun, 15 Dec 2019 18:35:59 +0800 Subject: [PATCH 06/10] up --- .../main/java/io/legado/app/ui/book/read/ReadBookActivity.kt | 4 +++- app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 9e584ca86..11c9dc5cf 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -256,7 +256,9 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo } override fun upContent(position: Int) { - page_view.upContent(position) + launch { + page_view.upContent(position) + } } override fun upView() { diff --git a/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt b/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt index b6e18a834..fdb9e4e2b 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt @@ -55,7 +55,7 @@ data class TextChapter( fun getReadLength(pageIndex: Int): Int { var length = 0 val maxIndex = min(pageIndex, pageLines.lastIndex) - for (index in 0 until maxIndex) { + for (index in 0..maxIndex) { length += pageLengths[index] } return length From 632f3066a7fcf8002a2900d6b6b60c34cf627ec3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 15 Dec 2019 19:07:14 +0800 Subject: [PATCH 07/10] up --- app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt b/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt index fdb9e4e2b..d9c57c4ce 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt @@ -54,8 +54,8 @@ data class TextChapter( fun getReadLength(pageIndex: Int): Int { var length = 0 - val maxIndex = min(pageIndex, pageLines.lastIndex) - for (index in 0..maxIndex) { + val maxIndex = min(pageIndex, pageLines.size) + for (index in 0 until maxIndex) { length += pageLengths[index] } return length From 391946cf8f4492501d23f3b92ebccd491c406016 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 15 Dec 2019 19:09:36 +0800 Subject: [PATCH 08/10] up --- app/src/main/assets/updateLog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index d424bc6cb..94c6d7ac3 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -6,6 +6,8 @@ **2019/12/15** * 修复清理缓存会把其他文件删除的问题 +* 详情页模糊背景 +* 修复朗读时最后一页显示不正确的问题 **2019/12/12** * [fix]web服务停止问题 From 6761f52084f398033a891e76655d7421f0cfe015 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 15 Dec 2019 19:10:35 +0800 Subject: [PATCH 09/10] up --- app/src/main/assets/updateLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 94c6d7ac3..9675470ac 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -1,7 +1,7 @@ ## 更新日志 * 旧版数据导入教程: -* 先在旧版阅读2.19进行备份,再在新版阅读3.0的【我的】中,点击【备份与恢复】,选择【导入旧版本数据】,提示需要存储权限,选择允许即可导入成功。 +* 先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】,提示存储权限,选择允许即可导入成功。 * 注意:由于安卓10更改了权限策略,还需要给「允许安装其他应用」的权限才能导入源。MIUI11也需要此权限。 **2019/12/15** From 43acd88426be05f25d7cd2d31f0c0209591603a7 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 15 Dec 2019 19:12:04 +0800 Subject: [PATCH 10/10] up --- app/src/main/assets/updateLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 9675470ac..569f6d190 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -8,6 +8,7 @@ * 修复清理缓存会把其他文件删除的问题 * 详情页模糊背景 * 修复朗读时最后一页显示不正确的问题 +* 最近感冒了,发热咳嗽还没好,继续咸鱼 **2019/12/12** * [fix]web服务停止问题