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
|
### Fixes
|
||||||
- Fix Bangumi search results including novels ([@MajorTanya](https://github.com/MajorTanya)) ([#1885](https://github.com/mihonapp/mihon/pull/1885))
|
- 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
|
## [v0.18.0] - 2025-03-20
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,7 @@ abstract class PagerViewer(
|
||||||
pager.offscreenPageLimit = 1
|
pager.offscreenPageLimit = 1
|
||||||
pager.id = R.id.reader_pager
|
pager.id = R.id.reader_pager
|
||||||
pager.adapter = adapter
|
pager.adapter = adapter
|
||||||
pager.addOnPageChangeListener(
|
pager.addOnPageChangeListener(pagerListener)
|
||||||
// SY -->
|
|
||||||
pagerListener,
|
|
||||||
// SY <--
|
|
||||||
)
|
|
||||||
pager.tapListener = { event ->
|
pager.tapListener = { event ->
|
||||||
val viewPosition = IntArray(2)
|
val viewPosition = IntArray(2)
|
||||||
pager.getLocationOnScreen(viewPosition)
|
pager.getLocationOnScreen(viewPosition)
|
||||||
|
|
@ -302,6 +298,9 @@ abstract class PagerViewer(
|
||||||
* Sets the active [chapters] on this pager.
|
* Sets the active [chapters] on this pager.
|
||||||
*/
|
*/
|
||||||
private fun setChaptersInternal(chapters: ViewerChapters) {
|
private fun setChaptersInternal(chapters: ViewerChapters) {
|
||||||
|
// Remove listener so the change in item doesn't trigger it
|
||||||
|
pager.removeOnPageChangeListener(pagerListener)
|
||||||
|
|
||||||
val forceTransition =
|
val forceTransition =
|
||||||
config.alwaysShowChapterTransition ||
|
config.alwaysShowChapterTransition ||
|
||||||
adapter.joinedItems.getOrNull(pager.currentItem)?.first is ChapterTransition
|
adapter.joinedItems.getOrNull(pager.currentItem)?.first is ChapterTransition
|
||||||
|
|
@ -314,6 +313,8 @@ abstract class PagerViewer(
|
||||||
moveToPage(pages[min(chapters.currChapter.requestedPage, pages.lastIndex)])
|
moveToPage(pages[min(chapters.currChapter.requestedPage, pages.lastIndex)])
|
||||||
pager.isVisible = true
|
pager.isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pager.addOnPageChangeListener(pagerListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue