From c5b978b442cc17e224fa894f9ed3ca7922082137 Mon Sep 17 00:00:00 2001 From: Horis <8674809+821938089@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:28:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/model/AudioPlay.kt | 3 ++- app/src/main/java/io/legado/app/service/AudioPlayService.kt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/model/AudioPlay.kt b/app/src/main/java/io/legado/app/model/AudioPlay.kt index e920dd211..947d31693 100644 --- a/app/src/main/java/io/legado/app/model/AudioPlay.kt +++ b/app/src/main/java/io/legado/app/model/AudioPlay.kt @@ -3,6 +3,7 @@ package io.legado.app.model import android.annotation.SuppressLint import android.content.Context import android.content.Intent +import io.legado.app.R import io.legado.app.constant.AppLog import io.legado.app.constant.EventBus import io.legado.app.constant.IntentAction @@ -182,7 +183,7 @@ object AudioPlay : CoroutineScope by MainScope() { val book = book ?: return durChapter = appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex) durAudioSize = durChapter?.end?.toInt() ?: 0 - postEvent(EventBus.AUDIO_SUB_TITLE, durChapter?.title ?: "") + postEvent(EventBus.AUDIO_SUB_TITLE, durChapter?.title ?: appCtx.getString(R.string.data_loading)) postEvent(EventBus.AUDIO_SIZE, durAudioSize) postEvent(EventBus.AUDIO_PROGRESS, durChapterPos) } 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 5cbac5d2b..cad78badf 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -423,6 +423,7 @@ class AudioPlayService : BaseService(), AudioPlay.playPositionChanged(exoPlayer.currentPosition.toInt()) postEvent(EventBus.AUDIO_BUFFER_PROGRESS, exoPlayer.bufferedPosition.toInt()) postEvent(EventBus.AUDIO_PROGRESS, AudioPlay.durChapterPos) + postEvent(EventBus.AUDIO_SIZE, exoPlayer.duration.toInt()) upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PLAYING) delay(1000) }