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 5fadc7be7..b0677197b 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 @@ -26,6 +26,7 @@ import io.legado.app.ui.main.MainActivity import io.legado.app.utils.applyTint import io.legado.app.utils.getViewModel import io.legado.app.utils.observeEvent +import io.legado.app.utils.observeEventSticky import kotlinx.android.synthetic.main.activity_audio_play.* import kotlinx.android.synthetic.main.view_title_bar.* import org.apache.commons.lang3.time.DateFormatUtils @@ -182,13 +183,13 @@ class AudioPlayActivity : VMBaseActivity(R.layout.activity_a fab_play_stop.setImageResource(R.drawable.ic_play_24dp) } } - observeEvent(Bus.AUDIO_PROGRESS) { + observeEventSticky(Bus.AUDIO_PROGRESS) { viewModel.durPageIndex = it if (!adjustProgress) player_progress.progress = it tv_dur_time.text = DateFormatUtils.format(it.toLong(), "mm:ss") viewModel.saveProgress() } - observeEvent(Bus.AUDIO_SIZE) { + observeEventSticky(Bus.AUDIO_SIZE) { player_progress.max = it tv_all_time.text = DateFormatUtils.format(it.toLong(), "mm:ss") }