|
|
@ -27,7 +27,6 @@ import kotlinx.coroutines.Dispatchers.IO |
|
|
|
class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
val bookData = MutableLiveData<Book>() |
|
|
|
val bookData = MutableLiveData<Book>() |
|
|
|
val chapterListData = MutableLiveData<List<BookChapter>>() |
|
|
|
val chapterListData = MutableLiveData<List<BookChapter>>() |
|
|
|
var durChapterIndex = 0 |
|
|
|
|
|
|
|
var inBookshelf = false |
|
|
|
var inBookshelf = false |
|
|
|
var bookSource: BookSource? = null |
|
|
|
var bookSource: BookSource? = null |
|
|
|
private var changeSourceCoroutine: Coroutine<*>? = null |
|
|
|
private var changeSourceCoroutine: Coroutine<*>? = null |
|
|
@ -70,7 +69,6 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
|
|
|
|
|
|
|
private fun upBook(book: Book) { |
|
|
|
private fun upBook(book: Book) { |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
durChapterIndex = book.durChapterIndex |
|
|
|
|
|
|
|
bookData.postValue(book) |
|
|
|
bookData.postValue(book) |
|
|
|
upCoverByRule(book) |
|
|
|
upCoverByRule(book) |
|
|
|
bookSource = if (book.isLocalBook()) null else |
|
|
|
bookSource = if (book.isLocalBook()) null else |
|
|
|