Rename pager adapter and horizontal view pager

This commit is contained in:
inorichi 2015-10-29 15:54:18 +01:00
parent 571c24d3d9
commit 95581007df
6 changed files with 21 additions and 20 deletions

View File

@ -8,11 +8,11 @@ import java.util.List;
import eu.kanade.mangafeed.data.models.Page; import eu.kanade.mangafeed.data.models.Page;
import eu.kanade.mangafeed.ui.fragment.ReaderPageFragment; import eu.kanade.mangafeed.ui.fragment.ReaderPageFragment;
public class ReaderPageAdapter extends SmartFragmentStatePagerAdapter { public class ViewerPagerAdapter extends SmartFragmentStatePagerAdapter {
private List<Page> pages; private List<Page> pages;
public ReaderPageAdapter(FragmentManager fragmentManager) { public ViewerPagerAdapter(FragmentManager fragmentManager) {
super(fragmentManager); super(fragmentManager);
} }

View File

@ -84,7 +84,7 @@ public class ReaderPageFragment extends Fragment {
if (page == null || page.getImagePath() == null) if (page == null || page.getImagePath() == null)
return; return;
imageView.setImage(ImageSource.uri(page.getImagePath())); imageView.setImage(ImageSource.uri(page.getImagePath()).tilingDisabled());
progressContainer.setVisibility(View.GONE); progressContainer.setVisibility(View.GONE);
} }

View File

@ -10,25 +10,25 @@ 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;
import eu.kanade.mangafeed.ui.adapter.ReaderPageAdapter; import eu.kanade.mangafeed.ui.adapter.ViewerPagerAdapter;
import eu.kanade.mangafeed.ui.viewer.base.BaseViewer; import eu.kanade.mangafeed.ui.viewer.base.BaseViewer;
import eu.kanade.mangafeed.widget.ReaderViewPager; import eu.kanade.mangafeed.widget.HorizontalViewPager;
import fr.castorflex.android.verticalviewpager.VerticalViewPager; import fr.castorflex.android.verticalviewpager.VerticalViewPager;
public class VerticalViewer extends BaseViewer { public class VerticalViewer extends BaseViewer {
@Bind(R.id.view_pager) VerticalViewPager viewPager; @Bind(R.id.view_pager) VerticalViewPager viewPager;
private ReaderPageAdapter adapter; private ViewerPagerAdapter 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); ButterKnife.bind(this, container);
adapter = new ReaderPageAdapter(activity.getSupportFragmentManager()); adapter = new ViewerPagerAdapter(activity.getSupportFragmentManager());
viewPager.setAdapter(adapter); viewPager.setAdapter(adapter);
viewPager.setOffscreenPageLimit(3); viewPager.setOffscreenPageLimit(3);
viewPager.setOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() { viewPager.setOnPageChangeListener(new HorizontalViewPager.OnPageChangeListener() {
@Override @Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

View File

@ -10,23 +10,24 @@ 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;
import eu.kanade.mangafeed.ui.adapter.ReaderPageAdapter; import eu.kanade.mangafeed.ui.adapter.ViewerPagerAdapter;
import eu.kanade.mangafeed.widget.ReaderViewPager; import eu.kanade.mangafeed.widget.HorizontalViewPager;
public abstract class ViewPagerViewer extends BaseViewer { public abstract class ViewPagerViewer extends BaseViewer {
@Bind(R.id.view_pager) ReaderViewPager viewPager; @Bind(R.id.view_pager)
protected ReaderPageAdapter adapter; HorizontalViewPager viewPager;
protected ViewerPagerAdapter 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); ButterKnife.bind(this, container);
adapter = new ReaderPageAdapter(activity.getSupportFragmentManager()); adapter = new ViewerPagerAdapter(activity.getSupportFragmentManager());
viewPager.setAdapter(adapter); viewPager.setAdapter(adapter);
viewPager.setOffscreenPageLimit(3); viewPager.setOffscreenPageLimit(3);
viewPager.addOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() { viewPager.addOnPageChangeListener(new HorizontalViewPager.OnPageChangeListener() {
@Override @Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
@ -43,7 +44,7 @@ public abstract class ViewPagerViewer extends BaseViewer {
} }
}); });
viewPager.setOnChapterBoundariesOutListener(new ReaderViewPager.OnChapterBoundariesOutListener() { viewPager.setOnChapterBoundariesOutListener(new HorizontalViewPager.OnChapterBoundariesOutListener() {
@Override @Override
public void onFirstPageOutEvent() { public void onFirstPageOutEvent() {
onFirstPageOut(); onFirstPageOut();
@ -57,7 +58,7 @@ public abstract class ViewPagerViewer extends BaseViewer {
viewPager.setOnChapterSingleTapListener(activity::onCenterSingleTap); viewPager.setOnChapterSingleTapListener(activity::onCenterSingleTap);
} }
public ReaderViewPager getViewPager() { public HorizontalViewPager getViewPager() {
return viewPager; return viewPager;
} }

View File

@ -6,7 +6,7 @@ import android.util.AttributeSet;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;
public class ReaderViewPager extends ViewPager { public class HorizontalViewPager extends ViewPager {
private GestureDetector gestureDetector; private GestureDetector gestureDetector;
@ -18,7 +18,7 @@ public class ReaderViewPager extends ViewPager {
private static final float SWIPE_TOLERANCE = 0.25f; private static final float SWIPE_TOLERANCE = 0.25f;
private float startDragX; private float startDragX;
public ReaderViewPager(Context context, AttributeSet attrs) { public HorizontalViewPager(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
gestureDetector = new GestureDetector(getContext(), new ReaderViewGestureListener()); gestureDetector = new GestureDetector(getContext(), new ReaderViewGestureListener());
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<eu.kanade.mangafeed.widget.ReaderViewPager <eu.kanade.mangafeed.widget.HorizontalViewPager
android:id="@+id/view_pager" android:id="@+id/view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
</eu.kanade.mangafeed.widget.ReaderViewPager> </eu.kanade.mangafeed.widget.HorizontalViewPager>