|
|
@ -29,6 +29,9 @@ object AudioPlay { |
|
|
|
return bookSource?.getHeaderMap() |
|
|
|
return bookSource?.getHeaderMap() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 播放当前章节 |
|
|
|
|
|
|
|
*/ |
|
|
|
fun play(context: Context) { |
|
|
|
fun play(context: Context) { |
|
|
|
book?.let { |
|
|
|
book?.let { |
|
|
|
if (durChapter == null) { |
|
|
|
if (durChapter == null) { |
|
|
@ -42,6 +45,9 @@ object AudioPlay { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 更新当前章节 |
|
|
|
|
|
|
|
*/ |
|
|
|
fun upDurChapter(book: Book) { |
|
|
|
fun upDurChapter(book: Book) { |
|
|
|
durChapter = appDb.bookChapterDao.getChapter(book.bookUrl, book.durChapterIndex) |
|
|
|
durChapter = appDb.bookChapterDao.getChapter(book.bookUrl, book.durChapterIndex) |
|
|
|
postEvent(EventBus.AUDIO_SUB_TITLE, durChapter?.title ?: "") |
|
|
|
postEvent(EventBus.AUDIO_SUB_TITLE, durChapter?.title ?: "") |
|
|
@ -148,11 +154,14 @@ object AudioPlay { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 保存章节长度 |
|
|
|
|
|
|
|
*/ |
|
|
|
fun saveDurChapter(audioSize: Long) { |
|
|
|
fun saveDurChapter(audioSize: Long) { |
|
|
|
Coroutine.async { |
|
|
|
Coroutine.async { |
|
|
|
durChapter?.let { |
|
|
|
durChapter?.let { |
|
|
|
it.end = audioSize |
|
|
|
it.end = audioSize |
|
|
|
appDb.bookChapterDao.insert(it) |
|
|
|
appDb.bookChapterDao.upDate(it) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|