From ef2b0f9cd1b51c2707de7b6c5cf7fdfad12755fd Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 5 Sep 2021 10:55:15 +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 | 1 - .../java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 9 +++++++++ .../main/java/io/legado/app/service/AudioPlayService.kt | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) 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 21d42c5d3..328ef34c9 100644 --- a/app/src/main/java/io/legado/app/model/AudioPlay.kt +++ b/app/src/main/java/io/legado/app/model/AudioPlay.kt @@ -37,7 +37,6 @@ object AudioPlay { durChapter?.let { context.startService { action = IntentAction.play - } } } diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 65d1ae59a..476de1532 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -314,6 +314,9 @@ class AnalyzeUrl( } } + /** + * 访问网站,返回StrResponse + */ suspend fun getStrResponse( jsStr: String? = null, sourceRegex: String? = null, @@ -349,6 +352,9 @@ class AnalyzeUrl( } } + /** + * 访问网站,返回ByteArray + */ suspend fun getByteArray(): ByteArray { judgmentConcurrent() setCookie(source?.getStoreUrl()) @@ -369,6 +375,9 @@ class AnalyzeUrl( }.bytes() } + /** + * 上传文件 + */ suspend fun upload(fileName: String, file: ByteArray, contentType: String): StrResponse { return getProxyClient(proxy).newCallStrResponse(retry) { url(url) 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 73fd349b7..4a0dda3ae 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -115,6 +115,9 @@ class AudioPlayService : BaseService(), postEvent(EventBus.AUDIO_STATE, Status.STOP) } + /** + * 播放音频 + */ private fun play() { upNotification() if (requestFocus()) { @@ -122,7 +125,6 @@ class AudioPlayService : BaseService(), AudioPlay.status = Status.STOP postEvent(EventBus.AUDIO_STATE, Status.STOP) upPlayProgressJob?.cancel() - exoPlayer.clearMediaItems() val analyzeUrl = AnalyzeUrl( url,