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); ArrayList<Page> inversedPages = new ArrayList<>(pages);
Collections.reverse(inversedPages); Collections.reverse(inversedPages);
adapter.setPages(inversedPages); adapter.setPages(inversedPages);
viewPager.setCurrentItem(adapter.getCount()-1); getViewPager().setCurrentItem(adapter.getCount()-1);
} }
@Override @Override

View file

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

View file

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

View file

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