Merge pull request #1 from gedoor/master

up
pull/60/head
口口吕 5 years ago committed by GitHub
commit 871330eb3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      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. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  5. 6
      app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt
  6. 2
      app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt
  7. 3
      app/src/main/res/values/pref_key_value.xml
  8. 4
      app/src/main/res/xml/about.xml
  9. 11
      app/src/main/res/xml/pref_config.xml

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

@ -26,6 +26,15 @@ object BookHelp {
?: App.INSTANCE.cacheDir.absolutePath ?: 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) { fun saveContent(book: Book, bookChapter: BookChapter, content: String) {
if (content.isEmpty()) return if (content.isEmpty()) return
val filePath = getChapterPath(book, bookChapter) val filePath = getChapterPath(book, bookChapter)
@ -69,7 +78,7 @@ object BookHelp {
val bookFolder = formatFolderName(book.name + book.bookUrl) val bookFolder = formatFolderName(book.name + book.bookUrl)
val chapterFile = val chapterFile =
String.format("%05d-%s", bookChapter.index, MD5Utils.md5Encode(bookChapter.title)) 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 { private fun formatFolderName(folderName: String): String {

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

@ -256,7 +256,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
} }
override fun upContent(position: Int) { override fun upContent(position: Int) {
page_view.upContent(position) launch {
page_view.upContent(position)
}
} }
override fun upView() { override fun upView() {

@ -13,7 +13,6 @@ import io.legado.app.R
import io.legado.app.constant.Bus import io.legado.app.constant.Bus
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
@ -62,10 +61,7 @@ class ConfigFragment : PreferenceFragmentCompat(),
initPath = getPreferenceString(PreferKey.downloadPath) initPath = getPreferenceString(PreferKey.downloadPath)
) )
PreferKey.cleanCache -> { PreferKey.cleanCache -> {
getPreferenceString(PreferKey.downloadPath).let { BookHelp.clearCache()
FileHelp.deleteFile(it)
FileHelp.getFolder(it)
}
toast(R.string.clear_cache_success) toast(R.string.clear_cache_success)
} }
} }

@ -54,7 +54,7 @@ data class TextChapter(
fun getReadLength(pageIndex: Int): Int { fun getReadLength(pageIndex: Int): Int {
var length = 0 var length = 0
val maxIndex = min(pageIndex, pageLines.lastIndex) val maxIndex = min(pageIndex, pageLines.size)
for (index in 0 until maxIndex) { for (index in 0 until maxIndex) {
length += pageLengths[index] length += pageLengths[index]
} }

@ -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="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="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="disclaimer_url">https://gedoor.github.io/MyBookshelf/disclaimer.html</string>
<string name="home_page_url">https://gedoor.github.io/MyBookshelf/</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> <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"> xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.Preference <androidx.preference.Preference
android:key="isNightTheme" android:key="contributors"
android:title="开发人员" android:title="开发人员"
android:summary="gedoor, Invinciblelee, atbest, Antecer, mabDc, Ca1e" android:summary="gedoor,Invinciblelee等, 详情请在github中查看"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<androidx.preference.Preference <androidx.preference.Preference

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

Loading…
Cancel
Save