inorichi 9 жил өмнө
parent
commit
043ab7eca9

+ 4 - 4
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<CataloguePresenter> {
         }
     }
 
-    public void onAddPage(PageBundle<List<Manga>> page) {
+    public void onAddPage(Pair<Integer, List<Manga>> 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() {

+ 4 - 4
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<CatalogueFragment> {
         mangaDetailSubject = PublishSubject.create();
 
         restartableReplay(GET_MANGA_LIST,
-                () -> pager.pages().<PageBundle<List<Manga>>>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();

+ 0 - 12
app/src/main/java/eu/kanade/mangafeed/util/PageBundle.java

@@ -1,12 +0,0 @@
-package eu.kanade.mangafeed.util;
-
-public class PageBundle<T> {
-
-    public final int page;
-    public final T data;
-
-    public PageBundle(int page, T data) {
-        this.page = page;
-        this.data = data;
-    }
-}