Save reader progress when activity is paused (#7121)

This commit is contained in:
CVIUS 2022-05-14 20:51:04 +08:00 committed by GitHub
parent 6d655ff757
commit f1ab34e27c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -231,6 +231,11 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
super.onSaveInstanceState(outState)
}
override fun onPause() {
presenter.saveProgress()
super.onPause()
}
/**
* Set menu visibility again on activity resume to apply immersive mode again if needed.
* Helps with rotations.

View file

@ -465,6 +465,10 @@ class ReaderPresenter(
}
}
fun saveProgress() {
getCurrentChapter()?.let { onChapterChanged(it) }
}
/**
* Called from the activity to preload the given [chapter].
*/