diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderMenu.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderMenu.java index 39bb0e369..76a1c1e38 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderMenu.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderMenu.java @@ -147,8 +147,8 @@ public class ReaderMenu { // Set initial values totalPages.setText("" + numPages); currentPage.setText("" + (currentPageIndex + 1)); - seekBar.setProgress(currentPageIndex); seekBar.setMax(numPages - 1); + seekBar.setProgress(currentPageIndex); activity.setToolbarTitle(manga.title); activity.setToolbarSubtitle(chapter.chapter_number != -1 ? diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderAdapter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderAdapter.java index 120d55048..bef8ac7d8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderAdapter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderAdapter.java @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.reader.viewer.pager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; +import android.view.ViewGroup; import java.util.List; @@ -23,7 +24,19 @@ public class PagerReaderAdapter extends FragmentStatePagerAdapter { @Override public Fragment getItem(int position) { - return PagerReaderFragment.newInstance(pages.get(position)); + return PagerReaderFragment.newInstance(); + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + PagerReaderFragment f = (PagerReaderFragment) super.instantiateItem(container, position); + f.setPage(pages.get(position)); + return f; + } + + @Override + public int getItemPosition(Object object) { + return POSITION_NONE; } public List getPages() { @@ -35,9 +48,4 @@ public class PagerReaderAdapter extends FragmentStatePagerAdapter { notifyDataSetChanged(); } - @Override - public int getItemPosition(Object object) { - return POSITION_NONE; - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java index 6c3c0b172..a0279d91c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java @@ -41,13 +41,12 @@ public class PagerReaderFragment extends BaseFragment { @Bind(R.id.retry_button) Button retryButton; private Page page; + private boolean isReady; private Subscription progressSubscription; private Subscription statusSubscription; - public static PagerReaderFragment newInstance(Page page) { - PagerReaderFragment fragment = new PagerReaderFragment(); - fragment.setPage(page); - return fragment; + public static PagerReaderFragment newInstance() { + return new PagerReaderFragment(); } @Override @@ -86,6 +85,7 @@ public class PagerReaderFragment extends BaseFragment { }); observeStatus(); + isReady = true; return view; } @@ -99,6 +99,9 @@ public class PagerReaderFragment extends BaseFragment { public void setPage(Page page) { this.page = page; + if (isReady) { + observeStatus(); + } } private void showImage() {