@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user