diff --git a/app/src/main/java/eu/kanade/mangafeed/presenter/CatalogueListPresenter.java b/app/src/main/java/eu/kanade/mangafeed/presenter/CatalogueListPresenter.java index c879fd4ab..e8526ce42 100644 --- a/app/src/main/java/eu/kanade/mangafeed/presenter/CatalogueListPresenter.java +++ b/app/src/main/java/eu/kanade/mangafeed/presenter/CatalogueListPresenter.java @@ -125,31 +125,23 @@ public class CatalogueListPresenter extends BasePresenter { // If going to search mode else if (mSearchName.equals("") && !query.equals("")) { mSearchMode = true; - mSearchName = query; - adapter.setItems(new ArrayList<>()); - getMangasFromSearch(1); } // If going to normal mode else if (!mSearchName.equals("") && query.equals("")) { mSearchMode = false; - mSearchName = query; - adapter.setItems(new ArrayList<>()); - getMangasFromSource(1); - } - // If query changes - else { - mSearchName = query; - adapter.setItems(new ArrayList<>()); - getMangasFromSearch(1); } + + mSearchName = query; + adapter.getItems().clear(); + loadMoreMangas(1); view.setScrollListener(); } public void loadMoreMangas(int page) { - if (!mSearchMode) { - getMangasFromSource(page); - } else { + if (mSearchMode) { getMangasFromSearch(page); + } else { + getMangasFromSource(page); } } diff --git a/app/src/main/java/eu/kanade/mangafeed/sources/Source.java b/app/src/main/java/eu/kanade/mangafeed/sources/Source.java index f3c144344..9f2653f9e 100644 --- a/app/src/main/java/eu/kanade/mangafeed/sources/Source.java +++ b/app/src/main/java/eu/kanade/mangafeed/sources/Source.java @@ -40,6 +40,7 @@ public abstract class Source { .flatMap(response -> Observable.just(parsePopularMangasFromHtml(response))); } + // Get mangas from the source with a query public Observable> searchMangasFromNetwork(String query, int page) { return mNetworkService .getStringResponse(getSearchUrl(query, page), mNetworkService.NULL_CACHE_CONTROL, mRequestHeaders)