Minor changes

This commit is contained in:
inorichi 2015-10-26 01:55:36 +01:00
parent 0e9e80b081
commit e975860420
4 changed files with 15 additions and 7 deletions

View File

@ -21,7 +21,7 @@ public class RightToLeftViewer extends ViewPagerViewer {
ArrayList<Page> inversedPages = new ArrayList<>(pages);
Collections.reverse(inversedPages);
adapter.setPages(inversedPages);
viewPager.setCurrentItem(adapter.getCount()-1);
getViewPager().setCurrentItem(adapter.getCount()-1);
}
@Override

View File

@ -5,6 +5,8 @@ import android.widget.FrameLayout;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.models.Page;
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
@ -15,15 +17,15 @@ import fr.castorflex.android.verticalviewpager.VerticalViewPager;
public class VerticalViewer extends BaseViewer {
private VerticalViewPager viewPager;
@Bind(R.id.view_pager) VerticalViewPager viewPager;
private ReaderPageAdapter adapter;
public VerticalViewer(ReaderActivity activity, FrameLayout container) {
super(activity, container);
activity.getLayoutInflater().inflate(R.layout.viewer_verticalviewpager, container);
ButterKnife.bind(this, container);
adapter = new ReaderPageAdapter(activity.getSupportFragmentManager());
viewPager = (VerticalViewPager) activity.findViewById(R.id.view_pager);
viewPager.setAdapter(adapter);
viewPager.setOffscreenPageLimit(3);
viewPager.setOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() {

View File

@ -5,6 +5,8 @@ import android.widget.FrameLayout;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.models.Page;
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
@ -13,15 +15,15 @@ import eu.kanade.mangafeed.widget.ReaderViewPager;
public abstract class ViewPagerViewer extends BaseViewer {
protected ReaderViewPager viewPager;
@Bind(R.id.view_pager) ReaderViewPager viewPager;
protected ReaderPageAdapter adapter;
public ViewPagerViewer(ReaderActivity activity, FrameLayout container) {
super(activity, container);
activity.getLayoutInflater().inflate(R.layout.viewer_viewpager, container);
ButterKnife.bind(this, container);
adapter = new ReaderPageAdapter(activity.getSupportFragmentManager());
viewPager = (ReaderViewPager) activity.findViewById(R.id.view_pager);
viewPager.setAdapter(adapter);
viewPager.setOffscreenPageLimit(3);
viewPager.addOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() {
@ -54,6 +56,10 @@ public abstract class ViewPagerViewer extends BaseViewer {
});
}
public ReaderViewPager getViewPager() {
return viewPager;
}
@Override
public int getTotalPages() {
return adapter.getCount();

View File

@ -2,12 +2,12 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference android:title="@string/pref_hide_status_bar"
android:key="pref_hide_status_bar_key"
android:key="@string/pref_hide_status_bar_key"
android:defaultValue="false"
android:summary="@string/pref_hide_status_bar_summary" />
<ListPreference android:title="@string/pref_viewer_type"
android:key="pref_default_viewer_key"
android:key="@string/pref_default_viewer_key"
android:entries="@array/viewers"
android:entryValues="@array/viewers_values"
android:defaultValue="1"/>