|
|
@ -114,8 +114,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
waitUpTocBooks.remove(bookUrl) |
|
|
|
waitUpTocBooks.remove(bookUrl) |
|
|
|
onUpTocBooks.add(bookUrl) |
|
|
|
upTocAdd(bookUrl) |
|
|
|
postEvent(EventBus.UP_BOOKSHELF, bookUrl) |
|
|
|
|
|
|
|
execute(context = upTocPool) { |
|
|
|
execute(context = upTocPool) { |
|
|
|
val preUpdateJs = source.ruleToc?.preUpdateJs |
|
|
|
val preUpdateJs = source.ruleToc?.preUpdateJs |
|
|
|
if (!preUpdateJs.isNullOrBlank()) { |
|
|
|
if (!preUpdateJs.isNullOrBlank()) { |
|
|
@ -128,7 +127,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
if (book.bookUrl == bookUrl) { |
|
|
|
if (book.bookUrl == bookUrl) { |
|
|
|
appDb.bookDao.update(book) |
|
|
|
appDb.bookDao.update(book) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
onUpTocBooks.add(book.bookUrl) |
|
|
|
upTocAdd(book.bookUrl) |
|
|
|
appDb.bookDao.insert(book) |
|
|
|
appDb.bookDao.insert(book) |
|
|
|
} |
|
|
|
} |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
@ -145,10 +144,17 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
|
|
|
|
private fun upTocAdd(bookUrl: String) { |
|
|
|
|
|
|
|
onUpTocBooks.add(bookUrl) |
|
|
|
|
|
|
|
postEvent(EventBus.UP_BOOKSHELF, bookUrl) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
private fun upTocCancel(bookUrl: String) { |
|
|
|
private fun upTocCancel(bookUrl: String) { |
|
|
|
onUpTocBooks.remove(bookUrl) |
|
|
|
onUpTocBooks.remove(bookUrl) |
|
|
|
waitUpTocBooks.add(bookUrl) |
|
|
|
waitUpTocBooks.add(bookUrl) |
|
|
|
|
|
|
|
postEvent(EventBus.UP_BOOKSHELF, bookUrl) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|