From 95581007dfe58ec37bb8859d1d1acf59d275abf9 Mon Sep 17 00:00:00 2001 From: inorichi Date: Thu, 29 Oct 2015 15:54:18 +0100 Subject: [PATCH] Rename pager adapter and horizontal view pager --- ...PageAdapter.java => ViewerPagerAdapter.java} | 4 ++-- .../ui/fragment/ReaderPageFragment.java | 2 +- .../mangafeed/ui/viewer/VerticalViewer.java | 10 +++++----- .../ui/viewer/base/ViewPagerViewer.java | 17 +++++++++-------- ...rViewPager.java => HorizontalViewPager.java} | 4 ++-- app/src/main/res/layout/viewer_viewpager.xml | 4 ++-- 6 files changed, 21 insertions(+), 20 deletions(-) rename app/src/main/java/eu/kanade/mangafeed/ui/adapter/{ReaderPageAdapter.java => ViewerPagerAdapter.java} (84%) rename app/src/main/java/eu/kanade/mangafeed/widget/{ReaderViewPager.java => HorizontalViewPager.java} (97%) diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ReaderPageAdapter.java b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ViewerPagerAdapter.java similarity index 84% rename from app/src/main/java/eu/kanade/mangafeed/ui/adapter/ReaderPageAdapter.java rename to app/src/main/java/eu/kanade/mangafeed/ui/adapter/ViewerPagerAdapter.java index 2df97cf70b..1035bca87d 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ReaderPageAdapter.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/ViewerPagerAdapter.java @@ -8,11 +8,11 @@ import java.util.List; import eu.kanade.mangafeed.data.models.Page; import eu.kanade.mangafeed.ui.fragment.ReaderPageFragment; -public class ReaderPageAdapter extends SmartFragmentStatePagerAdapter { +public class ViewerPagerAdapter extends SmartFragmentStatePagerAdapter { private List pages; - public ReaderPageAdapter(FragmentManager fragmentManager) { + public ViewerPagerAdapter(FragmentManager fragmentManager) { super(fragmentManager); } diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java index f3535a5996..baae29f884 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java @@ -84,7 +84,7 @@ public class ReaderPageFragment extends Fragment { if (page == null || page.getImagePath() == null) return; - imageView.setImage(ImageSource.uri(page.getImagePath())); + imageView.setImage(ImageSource.uri(page.getImagePath()).tilingDisabled()); progressContainer.setVisibility(View.GONE); } diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/VerticalViewer.java b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/VerticalViewer.java index b3081a1e79..161e6aa033 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/VerticalViewer.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/VerticalViewer.java @@ -10,25 +10,25 @@ import butterknife.ButterKnife; import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.data.models.Page; 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.widget.ReaderViewPager; +import eu.kanade.mangafeed.widget.HorizontalViewPager; import fr.castorflex.android.verticalviewpager.VerticalViewPager; public class VerticalViewer extends BaseViewer { @Bind(R.id.view_pager) VerticalViewPager viewPager; - private ReaderPageAdapter adapter; + private ViewerPagerAdapter 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()); + adapter = new ViewerPagerAdapter(activity.getSupportFragmentManager()); viewPager.setAdapter(adapter); viewPager.setOffscreenPageLimit(3); - viewPager.setOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() { + viewPager.setOnPageChangeListener(new HorizontalViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/base/ViewPagerViewer.java b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/base/ViewPagerViewer.java index 2ebdbaab03..42cd7b39a2 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/base/ViewPagerViewer.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/base/ViewPagerViewer.java @@ -10,23 +10,24 @@ import butterknife.ButterKnife; import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.data.models.Page; import eu.kanade.mangafeed.ui.activity.ReaderActivity; -import eu.kanade.mangafeed.ui.adapter.ReaderPageAdapter; -import eu.kanade.mangafeed.widget.ReaderViewPager; +import eu.kanade.mangafeed.ui.adapter.ViewerPagerAdapter; +import eu.kanade.mangafeed.widget.HorizontalViewPager; public abstract class ViewPagerViewer extends BaseViewer { - @Bind(R.id.view_pager) ReaderViewPager viewPager; - protected ReaderPageAdapter adapter; + @Bind(R.id.view_pager) + HorizontalViewPager viewPager; + protected ViewerPagerAdapter 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()); + adapter = new ViewerPagerAdapter(activity.getSupportFragmentManager()); viewPager.setAdapter(adapter); viewPager.setOffscreenPageLimit(3); - viewPager.addOnPageChangeListener(new ReaderViewPager.OnPageChangeListener() { + viewPager.addOnPageChangeListener(new HorizontalViewPager.OnPageChangeListener() { @Override 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 public void onFirstPageOutEvent() { onFirstPageOut(); @@ -57,7 +58,7 @@ public abstract class ViewPagerViewer extends BaseViewer { viewPager.setOnChapterSingleTapListener(activity::onCenterSingleTap); } - public ReaderViewPager getViewPager() { + public HorizontalViewPager getViewPager() { return viewPager; } diff --git a/app/src/main/java/eu/kanade/mangafeed/widget/ReaderViewPager.java b/app/src/main/java/eu/kanade/mangafeed/widget/HorizontalViewPager.java similarity index 97% rename from app/src/main/java/eu/kanade/mangafeed/widget/ReaderViewPager.java rename to app/src/main/java/eu/kanade/mangafeed/widget/HorizontalViewPager.java index e5988c8b7d..5054f0b266 100644 --- a/app/src/main/java/eu/kanade/mangafeed/widget/ReaderViewPager.java +++ b/app/src/main/java/eu/kanade/mangafeed/widget/HorizontalViewPager.java @@ -6,7 +6,7 @@ import android.util.AttributeSet; import android.view.GestureDetector; import android.view.MotionEvent; -public class ReaderViewPager extends ViewPager { +public class HorizontalViewPager extends ViewPager { private GestureDetector gestureDetector; @@ -18,7 +18,7 @@ public class ReaderViewPager extends ViewPager { private static final float SWIPE_TOLERANCE = 0.25f; private float startDragX; - public ReaderViewPager(Context context, AttributeSet attrs) { + public HorizontalViewPager(Context context, AttributeSet attrs) { super(context, attrs); gestureDetector = new GestureDetector(getContext(), new ReaderViewGestureListener()); } diff --git a/app/src/main/res/layout/viewer_viewpager.xml b/app/src/main/res/layout/viewer_viewpager.xml index ceef0ae9cf..819cfb5e76 100644 --- a/app/src/main/res/layout/viewer_viewpager.xml +++ b/app/src/main/res/layout/viewer_viewpager.xml @@ -1,7 +1,7 @@ - - \ No newline at end of file + \ No newline at end of file