|
|
@ -161,8 +161,10 @@ class AudioPlayService : BaseService(), |
|
|
|
|
|
|
|
|
|
|
|
private fun resume() { |
|
|
|
private fun resume() { |
|
|
|
pause = false |
|
|
|
pause = false |
|
|
|
mediaPlayer.start() |
|
|
|
if (!mediaPlayer.isPlaying) { |
|
|
|
mediaPlayer.seekTo(position) |
|
|
|
mediaPlayer.start() |
|
|
|
|
|
|
|
mediaPlayer.seekTo(position) |
|
|
|
|
|
|
|
} |
|
|
|
handler.removeCallbacks(mpRunnable) |
|
|
|
handler.removeCallbacks(mpRunnable) |
|
|
|
handler.postDelayed(mpRunnable, 1000) |
|
|
|
handler.postDelayed(mpRunnable, 1000) |
|
|
|
upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PLAYING) |
|
|
|
upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PLAYING) |
|
|
@ -337,7 +339,7 @@ class AudioPlayService : BaseService(), |
|
|
|
AudioPlay.durChapterIndex-- |
|
|
|
AudioPlay.durChapterIndex-- |
|
|
|
AudioPlay.durPageIndex = 0 |
|
|
|
AudioPlay.durPageIndex = 0 |
|
|
|
AudioPlay.book?.durChapterIndex = AudioPlay.durChapterIndex |
|
|
|
AudioPlay.book?.durChapterIndex = AudioPlay.durChapterIndex |
|
|
|
saveRead() |
|
|
|
AudioPlay.saveRead() |
|
|
|
position = 0 |
|
|
|
position = 0 |
|
|
|
loadContent(AudioPlay.durChapterIndex) |
|
|
|
loadContent(AudioPlay.durChapterIndex) |
|
|
|
} |
|
|
|
} |
|
|
@ -349,7 +351,7 @@ class AudioPlayService : BaseService(), |
|
|
|
AudioPlay.durChapterIndex++ |
|
|
|
AudioPlay.durChapterIndex++ |
|
|
|
AudioPlay.durPageIndex = 0 |
|
|
|
AudioPlay.durPageIndex = 0 |
|
|
|
AudioPlay.book?.durChapterIndex = AudioPlay.durChapterIndex |
|
|
|
AudioPlay.book?.durChapterIndex = AudioPlay.durChapterIndex |
|
|
|
saveRead() |
|
|
|
AudioPlay.saveRead() |
|
|
|
position = 0 |
|
|
|
position = 0 |
|
|
|
loadContent(AudioPlay.durChapterIndex) |
|
|
|
loadContent(AudioPlay.durChapterIndex) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -357,19 +359,6 @@ class AudioPlayService : BaseService(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun saveRead() { |
|
|
|
|
|
|
|
launch(IO) { |
|
|
|
|
|
|
|
AudioPlay.book?.let { book -> |
|
|
|
|
|
|
|
book.lastCheckCount = 0 |
|
|
|
|
|
|
|
book.durChapterTime = System.currentTimeMillis() |
|
|
|
|
|
|
|
book.durChapterIndex = AudioPlay.durChapterIndex |
|
|
|
|
|
|
|
book.durChapterPos = AudioPlay.durPageIndex |
|
|
|
|
|
|
|
book.durChapterTitle = subtitle |
|
|
|
|
|
|
|
App.db.bookDao().update(book) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun saveProgress() { |
|
|
|
private fun saveProgress() { |
|
|
|
launch(IO) { |
|
|
|
launch(IO) { |
|
|
|
AudioPlay.book?.let { |
|
|
|
AudioPlay.book?.let { |
|
|
|