|
|
@ -16,7 +16,6 @@ import kotlinx.coroutines.Dispatchers |
|
|
|
class AudioPlayViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
class AudioPlayViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
var inBookshelf = false |
|
|
|
var inBookshelf = false |
|
|
|
var bookData = MutableLiveData<Book>() |
|
|
|
var bookData = MutableLiveData<Book>() |
|
|
|
val chapterListFinish = MutableLiveData<Boolean>() |
|
|
|
|
|
|
|
var chapterSize = 0 |
|
|
|
var chapterSize = 0 |
|
|
|
var callBack: ReadBookViewModel.CallBack? = null |
|
|
|
var callBack: ReadBookViewModel.CallBack? = null |
|
|
|
var durChapterIndex = 0 |
|
|
|
var durChapterIndex = 0 |
|
|
@ -53,7 +52,7 @@ class AudioPlayViewModel(application: Application) : BaseViewModel(application) |
|
|
|
durChapterIndex = count - 1 |
|
|
|
durChapterIndex = count - 1 |
|
|
|
} |
|
|
|
} |
|
|
|
chapterSize = count |
|
|
|
chapterSize = count |
|
|
|
chapterListFinish.postValue(true) |
|
|
|
callBack?.loadContent() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
saveRead(book) |
|
|
|
saveRead(book) |
|
|
@ -83,7 +82,7 @@ class AudioPlayViewModel(application: Application) : BaseViewModel(application) |
|
|
|
if (changeDruChapterIndex == null) { |
|
|
|
if (changeDruChapterIndex == null) { |
|
|
|
App.db.bookChapterDao().insert(*cList.toTypedArray()) |
|
|
|
App.db.bookChapterDao().insert(*cList.toTypedArray()) |
|
|
|
chapterSize = cList.size |
|
|
|
chapterSize = cList.size |
|
|
|
chapterListFinish.postValue(true) |
|
|
|
callBack?.loadContent() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
changeDruChapterIndex(cList) |
|
|
|
changeDruChapterIndex(cList) |
|
|
|
} |
|
|
|
} |
|
|
|