ViewerPageAdapter.java 883 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package eu.kanade.mangafeed.ui.adapter;
  2. import android.support.v4.app.Fragment;
  3. import android.support.v4.app.FragmentManager;
  4. import java.util.List;
  5. import eu.kanade.mangafeed.ui.fragment.ViewerPageFragment;
  6. public class ViewerPageAdapter extends SmartFragmentStatePagerAdapter {
  7. private List<String> imageUrls;
  8. public ViewerPageAdapter(FragmentManager fragmentManager) {
  9. super(fragmentManager);
  10. }
  11. @Override
  12. public int getCount() {
  13. if (imageUrls != null)
  14. return imageUrls.size();
  15. return 0;
  16. }
  17. @Override
  18. public Fragment getItem(int position) {
  19. return ViewerPageFragment.newInstance(imageUrls.get(position), position);
  20. }
  21. public List<String> getImageUrls() {
  22. return imageUrls;
  23. }
  24. public void setImageUrls(List<String> imageUrls) {
  25. this.imageUrls = imageUrls;
  26. }
  27. }