mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-27 09:44:55 +03:00
Fix an issue with seamless mode and chapters with less than 5 pages #291
This commit is contained in:
parent
f629db3c10
commit
6af78418a4
1 changed files with 8 additions and 5 deletions
|
@ -94,14 +94,17 @@ abstract class BaseReader : BaseFragment() {
|
||||||
if (readerActivity.presenter.isSeamlessMode) {
|
if (readerActivity.presenter.isSeamlessMode) {
|
||||||
val oldChapter = oldPage.chapter
|
val oldChapter = oldPage.chapter
|
||||||
val newChapter = newPage.chapter
|
val newChapter = newPage.chapter
|
||||||
if (!hasRequestedNextChapter && position > pages.size - 5) {
|
|
||||||
|
// Active chapter has changed.
|
||||||
|
if (oldChapter.id != newChapter.id) {
|
||||||
|
readerActivity.onEnterChapter(newPage.chapter, newPage.pageNumber)
|
||||||
|
}
|
||||||
|
// Request next chapter only when the conditions are met.
|
||||||
|
if (pages.size - position < 5 && chapters.last().id == newChapter.id
|
||||||
|
&& readerActivity.presenter.hasNextChapter() && !hasRequestedNextChapter) {
|
||||||
hasRequestedNextChapter = true
|
hasRequestedNextChapter = true
|
||||||
readerActivity.presenter.appendNextChapter()
|
readerActivity.presenter.appendNextChapter()
|
||||||
}
|
}
|
||||||
if (oldChapter.id != newChapter.id) {
|
|
||||||
// Active chapter has changed.
|
|
||||||
readerActivity.onEnterChapter(newPage.chapter, newPage.pageNumber)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
currentPage = position
|
currentPage = position
|
||||||
updatePageNumber()
|
updatePageNumber()
|
||||||
|
|
Loading…
Reference in a new issue