diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java index cbe7eabde..aa27e2e52 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java @@ -164,6 +164,10 @@ public class ReaderActivity extends BaseRxActivity { } public void onChapterReady(List pages, Manga manga, Chapter chapter, int currentPage) { + if (currentPage == -1) { + currentPage = pages.size() - 1; + } + if (viewer == null) { viewer = createViewer(manga); getSupportFragmentManager().beginTransaction().replace(R.id.reader, viewer).commit(); diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java index e4321a82d..4834a5fd2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java @@ -215,8 +215,12 @@ public class ReaderPresenter extends BasePresenter { .doOnNext(mangaSync -> this.mangaSyncList = mangaSync); } - // Loads the given chapter private void loadChapter(Chapter chapter) { + loadChapter(chapter, 0); + } + + // Loads the given chapter + private void loadChapter(Chapter chapter, int requestedPage) { // Before loading the chapter, stop preloading (if it's working) and save current progress stopPreloadingNextChapter(); @@ -227,7 +231,7 @@ public class ReaderPresenter extends BasePresenter { if (!chapter.read && chapter.last_page_read != 0) currentPage = chapter.last_page_read; else - currentPage = 0; + currentPage = requestedPage; // Reset next and previous chapter. They have to be fetched again nextChapter = null; @@ -312,7 +316,7 @@ public class ReaderPresenter extends BasePresenter { public boolean loadNextChapter() { if (hasNextChapter()) { onChapterLeft(); - loadChapter(nextChapter); + loadChapter(nextChapter, 0); return true; } return false; @@ -321,7 +325,7 @@ public class ReaderPresenter extends BasePresenter { public boolean loadPreviousChapter() { if (hasPreviousChapter()) { onChapterLeft(); - loadChapter(previousChapter); + loadChapter(previousChapter, -1); return true; } return false;