Save reader progress when activity is paused

This commit is contained in:
Jay 2020-06-06 15:36:57 -04:00
parent 1978b9a62e
commit 14ec89f654
2 changed files with 7 additions and 0 deletions

View File

@ -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.

View File

@ -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).
*/ */