From aeb210bf4bb93b313cb3a3a9132c632a364cb5f4 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 25 Aug 2019 09:54:15 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/service/ReadAloudService.kt | 6 ++++-- .../main/java/io/legado/app/ui/readbook/ReadBookActivity.kt | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/ReadAloudService.kt b/app/src/main/java/io/legado/app/service/ReadAloudService.kt index ed47cb88f..a1e7ffd4e 100644 --- a/app/src/main/java/io/legado/app/service/ReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/ReadAloudService.kt @@ -28,11 +28,12 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage val tag: String = ReadAloudService::class.java.simpleName var isRun = false - fun play(context: Context, title: String, subtitle: String, body: String) { + fun play(context: Context, title: String, subtitle: String, readLength: Int, body: String) { val readAloudIntent = Intent(context, ReadAloudService::class.java) readAloudIntent.action = "play" readAloudIntent.putExtra("title", title) readAloudIntent.putExtra("subtitle", subtitle) + readAloudIntent.putExtra("readLength", readLength) readAloudIntent.putExtra("body", body) context.startService(readAloudIntent) } @@ -74,8 +75,8 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage var pause = false var title: String = "" var subtitle: String = "" - private var readAloudNumber: Int = 0 var timeMinute: Int = 0 + private var readAloudNumber: Int = 0 override fun onCreate() { super.onCreate() @@ -103,6 +104,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage "play" -> { title = intent.getStringExtra("title") ?: "" subtitle = intent.getStringExtra("subtitle") ?: "" + readAloudNumber = intent.getIntExtra("readLength", 0) newReadAloud(intent.getStringExtra("body")) } "pause" -> { diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index bf91ba595..e25694c50 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -301,7 +301,8 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea this, book.name, textChapter.title, - "" + textChapter.getReadLength(viewModel.durPageIndex), + textChapter.getUnRead(viewModel.durPageIndex) ) } }