From 08a563e7b3544729f38f82b42fac883e24c8a66e Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 9 Nov 2019 16:31:36 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/service/AudioPlayService.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index 3b6fc33c3..981c413f2 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -110,7 +110,6 @@ class AudioPlayService : BaseService(), } private fun play() { - postEvent(Bus.AUDIO_SUB_TITLE, subtitle) upNotification() if (requestFocus()) { try { @@ -230,6 +229,10 @@ class AudioPlayService : BaseService(), if (addLoading(index)) { launch(IO) { App.db.bookChapterDao().getChapter(book.bookUrl, index)?.let { chapter -> + if (index == AudioPlay.durChapterIndex) { + subtitle = chapter.title + postEvent(Bus.AUDIO_SUB_TITLE, subtitle) + } BookHelp.getContent(book, chapter)?.let { contentLoadFinish(chapter, it) removeLoading(chapter.index) @@ -285,6 +288,7 @@ class AudioPlayService : BaseService(), } private fun moveTo(index: Int) { + mediaPlayer.pause() AudioPlay.durChapterIndex = index AudioPlay.durPageIndex = 0 AudioPlay.book?.durChapterIndex = AudioPlay.durChapterIndex @@ -329,7 +333,7 @@ class AudioPlayService : BaseService(), } } - fun saveProgress() { + private fun saveProgress() { launch(IO) { AudioPlay.book?.let { App.db.bookDao().upProgress(it.bookUrl, AudioPlay.durPageIndex)