This commit is contained in:
inorichi 2016-02-01 20:53:06 +01:00
parent c4ae88a8ff
commit 7944bb8479
3 changed files with 22 additions and 11 deletions

View file

@ -147,8 +147,8 @@ public class ReaderMenu {
// Set initial values // Set initial values
totalPages.setText("" + numPages); totalPages.setText("" + numPages);
currentPage.setText("" + (currentPageIndex + 1)); currentPage.setText("" + (currentPageIndex + 1));
seekBar.setProgress(currentPageIndex);
seekBar.setMax(numPages - 1); seekBar.setMax(numPages - 1);
seekBar.setProgress(currentPageIndex);
activity.setToolbarTitle(manga.title); activity.setToolbarTitle(manga.title);
activity.setToolbarSubtitle(chapter.chapter_number != -1 ? activity.setToolbarSubtitle(chapter.chapter_number != -1 ?

View file

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.reader.viewer.pager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import java.util.List; import java.util.List;
@ -23,7 +24,19 @@ public class PagerReaderAdapter extends FragmentStatePagerAdapter {
@Override @Override
public Fragment getItem(int position) { 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<Page> getPages() { public List<Page> getPages() {
@ -35,9 +48,4 @@ public class PagerReaderAdapter extends FragmentStatePagerAdapter {
notifyDataSetChanged(); notifyDataSetChanged();
} }
@Override
public int getItemPosition(Object object) {
return POSITION_NONE;
}
} }

View file

@ -41,13 +41,12 @@ public class PagerReaderFragment extends BaseFragment {
@Bind(R.id.retry_button) Button retryButton; @Bind(R.id.retry_button) Button retryButton;
private Page page; private Page page;
private boolean isReady;
private Subscription progressSubscription; private Subscription progressSubscription;
private Subscription statusSubscription; private Subscription statusSubscription;
public static PagerReaderFragment newInstance(Page page) { public static PagerReaderFragment newInstance() {
PagerReaderFragment fragment = new PagerReaderFragment(); return new PagerReaderFragment();
fragment.setPage(page);
return fragment;
} }
@Override @Override
@ -86,6 +85,7 @@ public class PagerReaderFragment extends BaseFragment {
}); });
observeStatus(); observeStatus();
isReady = true;
return view; return view;
} }
@ -99,6 +99,9 @@ public class PagerReaderFragment extends BaseFragment {
public void setPage(Page page) { public void setPage(Page page) {
this.page = page; this.page = page;
if (isReady) {
observeStatus();
}
} }
private void showImage() { private void showImage() {