Merge pull request #1880 from Xwite/master

导入在线文件bug
pull/1881/head
kunfei 3 years ago committed by GitHub
commit 5ef43c426d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  2. 8
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt
  3. 1
      app/src/main/res/values-es-rES/strings.xml
  4. 1
      app/src/main/res/values-ja-rJP/strings.xml
  5. 1
      app/src/main/res/values-pt-rBR/strings.xml
  6. 1
      app/src/main/res/values-zh-rHK/strings.xml
  7. 1
      app/src/main/res/values-zh-rTW/strings.xml
  8. 1
      app/src/main/res/values-zh/strings.xml
  9. 1
      app/src/main/res/values/strings.xml

@ -230,7 +230,7 @@ class BookInfoActivity :
binding.tvToc.text = getString(R.string.toc_s, getString(R.string.loading)) binding.tvToc.text = getString(R.string.toc_s, getString(R.string.loading))
} }
chapterList.isNullOrEmpty() -> { chapterList.isNullOrEmpty() -> {
binding.tvToc.text = getString(R.string.toc_s, getString(R.string.error_load_toc)) binding.tvToc.text = if (viewModel.isImportBookOnLine) getString(R.string.click_read_button_load) else getString(R.string.toc_s, getString(R.string.error_load_toc))
} }
else -> { else -> {
viewModel.bookData.value?.let { viewModel.bookData.value?.let {

@ -78,7 +78,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
isImportBookOnLine = (bookSource?.bookSourceType ?: BookType.local) == BookType.file isImportBookOnLine = (bookSource?.bookSourceType ?: BookType.local) == BookType.file
if (book.tocUrl.isEmpty()) { if (book.tocUrl.isEmpty()) {
loadBookInfo(book) loadBookInfo(book)
} else if (!isImportBookOnLine) { } else if (isImportBookOnLine) {
chapterListData.postValue(emptyList())
} else {
val chapterList = appDb.bookChapterDao.getChapterList(book.bookUrl) val chapterList = appDb.bookChapterDao.getChapterList(book.bookUrl)
if (chapterList.isNotEmpty()) { if (chapterList.isNotEmpty()) {
chapterListData.postValue(chapterList) chapterListData.postValue(chapterList)
@ -111,7 +113,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
execute(scope) { execute(scope) {
if (book.isLocalBook()) { if (book.isLocalBook()) {
loadChapter(book, scope) loadChapter(book, scope)
} else if (!isImportBookOnLine) { } else {
bookSource?.let { bookSource -> bookSource?.let { bookSource ->
WebBook.getBookInfo(this, bookSource, book, canReName = canReName) WebBook.getBookInfo(this, bookSource, book, canReName = canReName)
.onSuccess(IO) { .onSuccess(IO) {
@ -144,6 +146,8 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
appDb.bookChapterDao.insert(*it.toTypedArray()) appDb.bookChapterDao.insert(*it.toTypedArray())
chapterListData.postValue(it) chapterListData.postValue(it)
} }
} else if (isImportBookOnLine) {
chapterListData.postValue(emptyList())
} else { } else {
bookSource?.let { bookSource -> bookSource?.let { bookSource ->
WebBook.getChapterList(this, bookSource, book) WebBook.getChapterList(this, bookSource, book)

@ -979,5 +979,6 @@
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string> <string name="auto_save_cookie">CookieJar</string>
<string name="click_read_button_load">点击阅读加载目录</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -982,5 +982,6 @@
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string> <string name="auto_save_cookie">CookieJar</string>
<string name="click_read_button_load">点击阅读加载目录</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -982,5 +982,6 @@
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string> <string name="auto_save_cookie">CookieJar</string>
<string name="click_read_button_load">点击阅读加载目录</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -979,5 +979,6 @@
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string> <string name="auto_save_cookie">CookieJar</string>
<string name="click_read_button_load">点击阅读加载目录</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -981,5 +981,6 @@
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string> <string name="auto_save_cookie">CookieJar</string>
<string name="click_read_button_load">点击阅读加载目录</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -981,5 +981,6 @@
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string> <string name="auto_save_cookie">CookieJar</string>
<string name="click_read_button_load">点击阅读加载目录</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -982,5 +982,6 @@
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string> <string name="auto_save_cookie">CookieJar</string>
<string name="click_read_button_load">点击阅读加载目录</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

Loading…
Cancel
Save