From 8edc779d9fcfd210959c94366315a1a3d78e3c9d Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 12 Dec 2020 22:58:05 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/audio/AudioPlayActivity.kt | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt index 76a60f6bb..aa8a95a83 100644 --- a/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt +++ b/app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt @@ -3,6 +3,7 @@ package io.legado.app.ui.audio import android.app.Activity import android.content.Intent import android.graphics.drawable.Drawable +import android.icu.text.SimpleDateFormat import android.os.Build import android.os.Bundle import android.view.Menu @@ -27,12 +28,14 @@ import io.legado.app.ui.book.toc.ChapterListActivity import io.legado.app.ui.widget.image.CoverImageView import io.legado.app.ui.widget.seekbar.SeekBarChangeListener import io.legado.app.utils.* -import org.apache.commons.lang3.time.DateFormatUtils import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onLongClick import org.jetbrains.anko.startActivityForResult +import java.util.* - +/** + * 音频播放 + */ class AudioPlayActivity : VMBaseActivity(toolBarTheme = Theme.Dark), ChangeSourceDialog.CallBack { @@ -42,6 +45,13 @@ class AudioPlayActivity : private var requestCodeChapter = 8461 private var adjustProgress = false + private val progressTimeFormat by lazy { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + SimpleDateFormat("mm:ss", Locale.getDefault()) + } else { + java.text.SimpleDateFormat("mm:ss", Locale.getDefault()) + } + } override fun getViewBinding(): ActivityAudioPlayBinding { return ActivityAudioPlayBinding.inflate(layoutInflater) @@ -85,7 +95,7 @@ class AudioPlayActivity : } binding.playerProgress.setOnSeekBarChangeListener(object : SeekBarChangeListener { override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { - binding.tvDurTime.text = DateFormatUtils.format(progress.toLong(), "mm:ss") + binding.tvDurTime.text = progressTimeFormat.format(progress.toLong()) } override fun onStartTrackingTouch(seekBar: SeekBar) { @@ -208,12 +218,12 @@ class AudioPlayActivity : } observeEventSticky(EventBus.AUDIO_SIZE) { binding.playerProgress.max = it - binding.tvAllTime.text = DateFormatUtils.format(it.toLong(), "mm:ss") + binding.tvAllTime.text = progressTimeFormat.format(it.toLong()) } observeEventSticky(EventBus.AUDIO_PROGRESS) { AudioPlay.durChapterPos = it if (!adjustProgress) binding.playerProgress.progress = it - binding.tvDurTime.text = DateFormatUtils.format(it.toLong(), "mm:ss") + binding.tvDurTime.text = progressTimeFormat.format(it.toLong()) } observeEventSticky(EventBus.AUDIO_SPEED) { binding.tvSpeed.text = String.format("%.1fX", it) From 9c501931605f9a63594459705745f73e500f1360 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 12 Dec 2020 23:06:32 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 346d88e3e..91d9ed383 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -190,7 +190,6 @@ dependencies { implementation 'com.jaredrummler:colorpicker:1.1.0' //apache - implementation 'org.apache.commons:commons-lang3:3.11' implementation 'org.apache.commons:commons-text:1.9' //字符串比较 From 5828e4ba1086712b8187b31fb5eb5cbaab1a7be8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 12 Dec 2020 23:31:44 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 91d9ed383..21b6a9842 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -190,7 +190,7 @@ dependencies { implementation 'com.jaredrummler:colorpicker:1.1.0' //apache - implementation 'org.apache.commons:commons-text:1.9' + implementation 'org.apache.commons:commons-text:1.9.1' //字符串比较 implementation 'net.ricecode:string-similarity:1.0.0' From 5542347843ee471e85400e3cb349e7baac69d57d Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 12 Dec 2020 23:34:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 21b6a9842..91d9ed383 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -190,7 +190,7 @@ dependencies { implementation 'com.jaredrummler:colorpicker:1.1.0' //apache - implementation 'org.apache.commons:commons-text:1.9.1' + implementation 'org.apache.commons:commons-text:1.9' //字符串比较 implementation 'net.ricecode:string-similarity:1.0.0' From 690cd9b0835c1917b657dfac432e157ce2b00ab3 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 12 Dec 2020 23:37:32 +0800 Subject: [PATCH 5/5] =?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/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 91d9ed383..0772e219c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -172,8 +172,8 @@ dependencies { implementation 'com.github.gedoor:rhino-android:1.4' //网络 - implementation 'com.ljx.rxhttp:rxhttp:2.4.4-beta3' implementation 'com.squareup.okhttp3:okhttp:4.9.0' + implementation 'com.ljx.rxhttp:rxhttp:2.4.4-beta3' kapt 'com.ljx.rxhttp:rxhttp-compiler:2.4.4-beta3' //Glide