Fix next chapter button occasionally jumping to the last page of the current chapter (mihonapp/mihon#1920)
(cherry picked from commit 941dde341eb11703eadae543f351c9284617541c)
This commit is contained in:
parent
a9cc060dc8
commit
b5177c5930
2 changed files with 7 additions and 5 deletions
|
|
@ -16,6 +16,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||
|
||||
### Fixes
|
||||
- Fix Bangumi search results including novels ([@MajorTanya](https://github.com/MajorTanya)) ([#1885](https://github.com/mihonapp/mihon/pull/1885))
|
||||
- Fix next chapter button occasionally jumping to the last page of the current chapter ([@perokhe](https://github.com/perokhe)) ([#1920](https://github.com/mihonapp/mihon/pull/1920))
|
||||
|
||||
## [v0.18.0] - 2025-03-20
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -116,11 +116,7 @@ abstract class PagerViewer(
|
|||
pager.offscreenPageLimit = 1
|
||||
pager.id = R.id.reader_pager
|
||||
pager.adapter = adapter
|
||||
pager.addOnPageChangeListener(
|
||||
// SY -->
|
||||
pagerListener,
|
||||
// SY <--
|
||||
)
|
||||
pager.addOnPageChangeListener(pagerListener)
|
||||
pager.tapListener = { event ->
|
||||
val viewPosition = IntArray(2)
|
||||
pager.getLocationOnScreen(viewPosition)
|
||||
|
|
@ -302,6 +298,9 @@ abstract class PagerViewer(
|
|||
* Sets the active [chapters] on this pager.
|
||||
*/
|
||||
private fun setChaptersInternal(chapters: ViewerChapters) {
|
||||
// Remove listener so the change in item doesn't trigger it
|
||||
pager.removeOnPageChangeListener(pagerListener)
|
||||
|
||||
val forceTransition =
|
||||
config.alwaysShowChapterTransition ||
|
||||
adapter.joinedItems.getOrNull(pager.currentItem)?.first is ChapterTransition
|
||||
|
|
@ -314,6 +313,8 @@ abstract class PagerViewer(
|
|||
moveToPage(pages[min(chapters.currChapter.requestedPage, pages.lastIndex)])
|
||||
pager.isVisible = true
|
||||
}
|
||||
|
||||
pager.addOnPageChangeListener(pagerListener)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue