From ebc606cf47c10b5e163cb896eafc5a4f504287a9 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 5 Nov 2019 09:05:28 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/audio/AudioPlayActivity.kt | 2 +- .../java/io/legado/app/ui/audio/AudioPlayViewModel.kt | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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 d2a7e19ce..a1c3c145f 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 @@ -45,7 +45,7 @@ class AudioPlayActivity : VMBaseActivity(R.layout.activity_a true } iv_skip_next.onClick { - + viewModel.moveToNext() } iv_skip_previous.onClick { diff --git a/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt b/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt index 458097f54..a3d3877d0 100644 --- a/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt @@ -184,6 +184,17 @@ class AudioPlayViewModel(application: Application) : BaseViewModel(application) } } + fun moveToPrev() { + if (durChapterIndex > 0) { + durChapterIndex-- + bookData.value?.let { + it.durChapterIndex = durChapterIndex + saveRead(it) + loadContent(it, durChapterIndex) + } + } + } + fun moveToNext() { if (durChapterIndex < chapterSize - 1) { durChapterIndex++