fix: 导入在线文件bug

This commit is contained in:
Xwite
2022-05-13 12:14:30 +08:00
parent a5f4ff16bc
commit d7d8845e98
9 changed files with 11 additions and 2 deletions

View File

@@ -230,7 +230,7 @@ class BookInfoActivity :
binding.tvToc.text = getString(R.string.toc_s, getString(R.string.loading))
}
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 -> {
viewModel.bookData.value?.let {

View File

@@ -111,7 +111,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
execute(scope) {
if (book.isLocalBook()) {
loadChapter(book, scope)
} else if (!isImportBookOnLine) {
} else {
bookSource?.let { bookSource ->
WebBook.getBookInfo(this, bookSource, book, canReName = canReName)
.onSuccess(IO) {
@@ -144,6 +144,8 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
appDb.bookChapterDao.insert(*it.toTypedArray())
chapterListData.postValue(it)
}
} else if(!isImportBookOnLine) {
chapterListData.postValue(emptyList())
} else {
bookSource?.let { bookSource ->
WebBook.getChapterList(this, bookSource, book)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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