mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Rename pager adapter and horizontal view pager
This commit is contained in:
parent
571c24d3d9
commit
95581007df
6 changed files with 21 additions and 20 deletions
|
@ -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<Page> pages;
|
||||
|
||||
public ReaderPageAdapter(FragmentManager fragmentManager) {
|
||||
public ViewerPagerAdapter(FragmentManager fragmentManager) {
|
||||
super(fragmentManager);
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<eu.kanade.mangafeed.widget.ReaderViewPager
|
||||
<eu.kanade.mangafeed.widget.HorizontalViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
</eu.kanade.mangafeed.widget.ReaderViewPager>
|
||||
</eu.kanade.mangafeed.widget.HorizontalViewPager>
|
Loading…
Reference in a new issue