Save reader progress when activity is paused

pull/3372/head
Jay 4 years ago
parent 1978b9a62e
commit 14ec89f654

@ -493,6 +493,11 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
please_wait.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in_long)) please_wait.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in_long))
} }
override fun onPause() {
presenter.saveProgress()
super.onPause()
}
/** /**
* Called from the presenter whenever a new [viewerChapters] have been set. It delegates the * Called from the presenter whenever a new [viewerChapters] have been set. It delegates the
* method to the current viewer, but also set the subtitle on the toolbar. * method to the current viewer, but also set the subtitle on the toolbar.

@ -391,6 +391,8 @@ class ReaderPresenter(
saveChapterHistory(fromChapter) saveChapterHistory(fromChapter)
} }
fun saveProgress() = getCurrentChapter()?.let { onChapterChanged(it) }
/** /**
* Saves this [chapter] progress (last read page and whether it's read). * Saves this [chapter] progress (last read page and whether it's read).
*/ */

Loading…
Cancel
Save