Fix double page progress when changing orientation (#799)
* Fix double page when changing orientation * Fix requested page, when device config changes when app is in BG * Cleanup on save reader logic
This commit is contained in:
parent
e8f9550211
commit
520846c75e
@ -614,6 +614,9 @@ class ReaderViewModel(
|
|||||||
* If incognito mode isn't on or has at least 1 tracker
|
* If incognito mode isn't on or has at least 1 tracker
|
||||||
*/
|
*/
|
||||||
private suspend fun saveChapterProgress(readerChapter: ReaderChapter) {
|
private suspend fun saveChapterProgress(readerChapter: ReaderChapter) {
|
||||||
|
// SY -->
|
||||||
|
readerChapter.requestedPage = readerChapter.chapter.last_page_read
|
||||||
|
// SY <--
|
||||||
if (!incognitoMode || hasTrackers) {
|
if (!incognitoMode || hasTrackers) {
|
||||||
val chapter = readerChapter.chapter
|
val chapter = readerChapter.chapter
|
||||||
getCurrentChapter()?.requestedPage = chapter.last_page_read
|
getCurrentChapter()?.requestedPage = chapter.last_page_read
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader.viewer.pager
|
package eu.kanade.tachiyomi.ui.reader.viewer.pager
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Parcelable
|
||||||
import android.view.HapticFeedbackConstants
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
@ -27,6 +28,18 @@ open class Pager(
|
|||||||
*/
|
*/
|
||||||
var longTapListener: ((MotionEvent) -> Boolean)? = null
|
var longTapListener: ((MotionEvent) -> Boolean)? = null
|
||||||
|
|
||||||
|
// SY -->
|
||||||
|
var isRestoring = false
|
||||||
|
|
||||||
|
override fun onRestoreInstanceState(state: Parcelable?) {
|
||||||
|
isRestoring = true
|
||||||
|
val currentItem = currentItem
|
||||||
|
super.onRestoreInstanceState(state)
|
||||||
|
setCurrentItem(currentItem, false)
|
||||||
|
isRestoring = false
|
||||||
|
}
|
||||||
|
// SY <--
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gesture listener that implements tap and long tap events.
|
* Gesture listener that implements tap and long tap events.
|
||||||
*/
|
*/
|
||||||
|
@ -86,6 +86,9 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
|
|
||||||
private val pagerListener = object : ViewPager.SimpleOnPageChangeListener() {
|
private val pagerListener = object : ViewPager.SimpleOnPageChangeListener() {
|
||||||
override fun onPageSelected(position: Int) {
|
override fun onPageSelected(position: Int) {
|
||||||
|
// SY -->
|
||||||
|
if (pager.isRestoring) return
|
||||||
|
// SY <--
|
||||||
if (activity.isScrollingThroughPages.not()) {
|
if (activity.isScrollingThroughPages.not()) {
|
||||||
activity.hideMenu()
|
activity.hideMenu()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user