diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/WebtoonAdapter.java b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/WebtoonAdapter.java index 946fb979c..8fbb481ea 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/WebtoonAdapter.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/WebtoonAdapter.java @@ -15,6 +15,7 @@ import uk.co.ribot.easyadapter.BaseEasyRecyclerAdapter; import uk.co.ribot.easyadapter.ItemViewHolder; import uk.co.ribot.easyadapter.PositionInfo; import uk.co.ribot.easyadapter.annotations.LayoutId; +import uk.co.ribot.easyadapter.annotations.ViewId; public class WebtoonAdapter extends BaseEasyRecyclerAdapter { @@ -40,20 +41,13 @@ public class WebtoonAdapter extends BaseEasyRecyclerAdapter { notifyDataSetChanged(); } - public void setPage(int position, Page page) { - pages.set(position, page); - notifyItemChanged(position); - } - - @LayoutId(R.layout.chapter_image) static class ImageViewHolder extends ItemViewHolder { - SubsamplingScaleImageView imageView; + @ViewId(R.id.page_image_view) SubsamplingScaleImageView imageView; public ImageViewHolder(View view) { super(view); - imageView = (SubsamplingScaleImageView) getView(); imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED); imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE); imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE); @@ -63,8 +57,13 @@ public class WebtoonAdapter extends BaseEasyRecyclerAdapter { @Override public void onSetValues(Page page, PositionInfo positionInfo) { - if (page.getImagePath() != null) + if (page.getImagePath() != null) { + imageView.setVisibility(View.VISIBLE); imageView.setImage(ImageSource.uri(page.getImagePath()).tilingDisabled()); + } else { + imageView.setVisibility(View.GONE); + } + } } } 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 b13d92a61..4e5e21dbf 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 @@ -2,7 +2,6 @@ package eu.kanade.mangafeed.ui.fragment; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -21,13 +20,14 @@ 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.fragment.base.BaseFragment; import rx.Observable; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; import rx.subjects.PublishSubject; -public class ReaderPageFragment extends Fragment { +public class ReaderPageFragment extends BaseFragment { @Bind(R.id.page_image_view) SubsamplingScaleImageView imageView; @Bind(R.id.progress_container) LinearLayout progressContainer; diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/RightToLeftViewer.java b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/RightToLeftViewer.java index 838f33ed9..feca69e24 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/RightToLeftViewer.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/RightToLeftViewer.java @@ -21,7 +21,7 @@ public class RightToLeftViewer extends ViewPagerViewer { ArrayList inversedPages = new ArrayList<>(pages); Collections.reverse(inversedPages); adapter.setPages(inversedPages); - getViewPager().setCurrentItem(adapter.getCount()-1); + getViewPager().setCurrentItem(adapter.getCount()-1, false); } @Override 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 161e6aa03..190046746 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 @@ -1,5 +1,6 @@ package eu.kanade.mangafeed.ui.viewer; +import android.support.v4.view.ViewPager; import android.view.MotionEvent; import android.widget.FrameLayout; @@ -12,7 +13,6 @@ import eu.kanade.mangafeed.data.models.Page; import eu.kanade.mangafeed.ui.activity.ReaderActivity; import eu.kanade.mangafeed.ui.adapter.ViewerPagerAdapter; import eu.kanade.mangafeed.ui.viewer.base.BaseViewer; -import eu.kanade.mangafeed.widget.HorizontalViewPager; import fr.castorflex.android.verticalviewpager.VerticalViewPager; public class VerticalViewer extends BaseViewer { @@ -28,7 +28,7 @@ public class VerticalViewer extends BaseViewer { adapter = new ViewerPagerAdapter(activity.getSupportFragmentManager()); viewPager.setAdapter(adapter); viewPager.setOffscreenPageLimit(3); - viewPager.setOnPageChangeListener(new HorizontalViewPager.OnPageChangeListener() { + viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/WebtoonViewer.java b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/WebtoonViewer.java index 36798a14a..293a69528 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/viewer/WebtoonViewer.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/viewer/WebtoonViewer.java @@ -21,7 +21,8 @@ public class WebtoonViewer extends BaseViewer { super(activity, container); recycler = new RecyclerView(activity); - recycler.setLayoutManager(new LinearLayoutManager(activity)); + LinearLayoutManager layoutManager = new LinearLayoutManager(activity); + recycler.setLayoutManager(layoutManager); adapter = new WebtoonAdapter(activity); recycler.setAdapter(adapter); 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 42cd7b39a..538c130e1 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 @@ -15,8 +15,7 @@ import eu.kanade.mangafeed.widget.HorizontalViewPager; public abstract class ViewPagerViewer extends BaseViewer { - @Bind(R.id.view_pager) - HorizontalViewPager viewPager; + @Bind(R.id.view_pager) HorizontalViewPager viewPager; protected ViewerPagerAdapter adapter; public ViewPagerViewer(ReaderActivity activity, FrameLayout container) { @@ -69,7 +68,7 @@ public abstract class ViewPagerViewer extends BaseViewer { @Override public void setSelectedPage(int pageNumber) { - viewPager.setCurrentItem(getCurrentPageIndex(pageNumber)); + viewPager.setCurrentItem(getCurrentPageIndex(pageNumber), false); } @Override diff --git a/app/src/main/res/layout/chapter_image.xml b/app/src/main/res/layout/chapter_image.xml index 0b661bba5..4d5217019 100644 --- a/app/src/main/res/layout/chapter_image.xml +++ b/app/src/main/res/layout/chapter_image.xml @@ -1,5 +1,13 @@ - \ No newline at end of file + android:layout_height="match_parent"> + + + + \ No newline at end of file