From 6cd6fbbf4ab59bf7aa541a480ab8444453e98bb1 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 11 Sep 2019 21:50:44 +0800 Subject: [PATCH] up --- .../java/io/legado/app/service/HttpReadAloudService.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index 2d8b15820..d590ab23d 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -76,8 +76,15 @@ class HttpReadAloudService : BaseReadAloudService(), } override fun onPrepared(mp: MediaPlayer?) { - mp?.start() super.play() + mp?.start() + textChapter?.let { + if (readAloudNumber + 1 > it.getReadLength(pageIndex + 1)) { + pageIndex++ + postEvent(Bus.TTS_TURN_PAGE, 1) + } + } + postEvent(Bus.TTS_START, readAloudNumber + 1) } override fun onError(mp: MediaPlayer?, what: Int, extra: Int): Boolean { @@ -86,6 +93,7 @@ class HttpReadAloudService : BaseReadAloudService(), } override fun onCompletion(mp: MediaPlayer?) { + readAloudNumber += contentList[nowSpeak].length + 1 if (nowSpeak < contentList.size) { nowSpeak++ play()