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) ) } }