From bee00cba18017c6bc8ae32f4054a259fdf3bc43e Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 9 Nov 2019 17:11:50 +0800 Subject: [PATCH] up --- .../legado/app/ui/audio/AudioPlayViewModel.kt | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt b/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt index 101b71b31..91e015fd7 100644 --- a/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt @@ -26,30 +26,30 @@ class AudioPlayViewModel(application: Application) : BaseViewModel(application) } else { App.db.bookDao().lastReadBook } - } - AudioPlay.book?.let { book -> - AudioPlay.titleData.postValue(book.name) - AudioPlay.coverData.postValue(book.getDisplayCover()) - AudioPlay.durChapterIndex = book.durChapterIndex - AudioPlay.durPageIndex = book.durChapterPos - App.db.bookSourceDao().getBookSource(book.origin)?.let { - AudioPlay.webBook = WebBook(it) - } - val count = App.db.bookChapterDao().getChapterCount(book.bookUrl) - if (count == 0) { - if (book.tocUrl.isEmpty()) { - loadBookInfo(book) - } else { - loadChapterList(book) + AudioPlay.book?.let { book -> + AudioPlay.titleData.postValue(book.name) + AudioPlay.coverData.postValue(book.getDisplayCover()) + AudioPlay.durChapterIndex = book.durChapterIndex + AudioPlay.durPageIndex = book.durChapterPos + App.db.bookSourceDao().getBookSource(book.origin)?.let { + AudioPlay.webBook = WebBook(it) } - } else { - if (AudioPlay.durChapterIndex > count - 1) { - AudioPlay.durChapterIndex = count - 1 + val count = App.db.bookChapterDao().getChapterCount(book.bookUrl) + if (count == 0) { + if (book.tocUrl.isEmpty()) { + loadBookInfo(book) + } else { + loadChapterList(book) + } + } else { + if (AudioPlay.durChapterIndex > count - 1) { + AudioPlay.durChapterIndex = count - 1 + } + AudioPlay.chapterSize = count } - AudioPlay.chapterSize = count } + saveRead() } - saveRead() } }