diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CatalogueFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CatalogueFragment.java index 6f3ae7c8f..b07359b23 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CatalogueFragment.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CatalogueFragment.java @@ -6,6 +6,7 @@ import android.os.Bundle; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.text.TextUtils; +import android.util.Pair; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -30,7 +31,6 @@ import eu.kanade.mangafeed.data.source.base.Source; import eu.kanade.mangafeed.ui.base.fragment.BaseRxFragment; import eu.kanade.mangafeed.ui.main.MainActivity; import eu.kanade.mangafeed.ui.manga.MangaActivity; -import eu.kanade.mangafeed.util.PageBundle; import eu.kanade.mangafeed.util.ToastUtil; import eu.kanade.mangafeed.widget.EndlessScrollListener; import icepick.Icepick; @@ -214,13 +214,13 @@ public class CatalogueFragment extends BaseRxFragment { } } - public void onAddPage(PageBundle> page) { + public void onAddPage(Pair> pair) { hideProgressBar(); - if (page.page == 0) { + if (pair.first == 0) { adapter.clear(); scrollListener.resetScroll(); } - adapter.addAll(page.data); + adapter.addAll(pair.second); } public void onAddPageError() { diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CataloguePresenter.java b/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CataloguePresenter.java index 00c70d736..62db49da9 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CataloguePresenter.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/catalogue/CataloguePresenter.java @@ -2,6 +2,7 @@ package eu.kanade.mangafeed.ui.catalogue; import android.os.Bundle; import android.text.TextUtils; +import android.util.Pair; import com.bumptech.glide.Glide; import com.pushtorefresh.storio.sqlite.operations.put.PutResult; @@ -18,7 +19,6 @@ import eu.kanade.mangafeed.data.source.SourceManager; import eu.kanade.mangafeed.data.source.base.Source; import eu.kanade.mangafeed.data.source.model.MangasPage; import eu.kanade.mangafeed.ui.base.presenter.BasePresenter; -import eu.kanade.mangafeed.util.PageBundle; import eu.kanade.mangafeed.util.RxPager; import rx.Observable; import rx.android.schedulers.AndroidSchedulers; @@ -57,14 +57,14 @@ public class CataloguePresenter extends BasePresenter { mangaDetailSubject = PublishSubject.create(); restartableReplay(GET_MANGA_LIST, - () -> pager.pages().>>concatMap( + () -> pager.pages().concatMap( page -> getMangaObs(page + 1) - .map(mangas -> new PageBundle<>(page, mangas)) + .map(mangas -> Pair.create(page, mangas)) .observeOn(AndroidSchedulers.mainThread())), (view, page) -> { view.onAddPage(page); if (mangaDetailSubject != null) - mangaDetailSubject.onNext(page.data); + mangaDetailSubject.onNext(page.second); }, (view, error) -> { view.onAddPageError(); diff --git a/app/src/main/java/eu/kanade/mangafeed/util/PageBundle.java b/app/src/main/java/eu/kanade/mangafeed/util/PageBundle.java deleted file mode 100644 index 5ad33bdc4..000000000 --- a/app/src/main/java/eu/kanade/mangafeed/util/PageBundle.java +++ /dev/null @@ -1,12 +0,0 @@ -package eu.kanade.mangafeed.util; - -public class PageBundle { - - public final int page; - public final T data; - - public PageBundle(int page, T data) { - this.page = page; - this.data = data; - } -} \ No newline at end of file