Browse Source

Save reader progress when activity is paused (#7121)

(cherry picked from commit f1ab34e27cbd8f26f87e34238af0863d4650b960)
CVIUS 2 years ago
parent
commit
fe80356756

+ 5 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt

@@ -226,6 +226,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.

+ 4 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt

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