|
|
@ -99,6 +99,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
if (book.isLocalBook()) { |
|
|
|
if (book.isLocalBook()) { |
|
|
|
AnalyzeTxtFile.analyze(context, book).let { |
|
|
|
AnalyzeTxtFile.analyze(context, book).let { |
|
|
|
App.db.bookChapterDao().insert(*it.toTypedArray()) |
|
|
|
App.db.bookChapterDao().insert(*it.toTypedArray()) |
|
|
|
|
|
|
|
App.db.bookDao().update(book) |
|
|
|
ReadBook.chapterSize = it.size |
|
|
|
ReadBook.chapterSize = it.size |
|
|
|
ReadBook.loadContent() |
|
|
|
ReadBook.loadContent() |
|
|
|
} |
|
|
|
} |
|
|
@ -108,6 +109,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
if (!cList.isNullOrEmpty()) { |
|
|
|
if (!cList.isNullOrEmpty()) { |
|
|
|
if (changeDruChapterIndex == null) { |
|
|
|
if (changeDruChapterIndex == null) { |
|
|
|
App.db.bookChapterDao().insert(*cList.toTypedArray()) |
|
|
|
App.db.bookChapterDao().insert(*cList.toTypedArray()) |
|
|
|
|
|
|
|
App.db.bookDao().update(book) |
|
|
|
ReadBook.chapterSize = cList.size |
|
|
|
ReadBook.chapterSize = cList.size |
|
|
|
ReadBook.loadContent() |
|
|
|
ReadBook.loadContent() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|