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 2455544ee..ba8f1a52b 100644 --- a/app/src/main/java/eu/kanade/mangafeed/presenter/CatalogueListPresenter.java +++ b/app/src/main/java/eu/kanade/mangafeed/presenter/CatalogueListPresenter.java @@ -58,6 +58,7 @@ public class CatalogueListPresenter extends BasePresenter { initializeSearch(); initializeMangaDetailsLoader(); + view.showProgressBar(); getMangasFromSource(1); } @@ -154,6 +155,7 @@ public class CatalogueListPresenter extends BasePresenter { .map(this::networkToLocalManga) .toList() .subscribe(newMangas -> { + view.hideProgressBar(); adapter.addItems(newMangas); if (mMangaDetailPublishSubject != null) mMangaDetailPublishSubject.onNext(Observable.just(newMangas)); @@ -174,7 +176,6 @@ public class CatalogueListPresenter extends BasePresenter { mSearchViewPublishSubject.onNext(Observable.just(query)); } - private void queryFromSearch(String query) { // If search button clicked if (mSearchName.equals("") && query.equals("")) { @@ -191,11 +192,15 @@ public class CatalogueListPresenter extends BasePresenter { mSearchName = query; adapter.getItems().clear(); + view.showProgressBar(); view.resetScrollListener(); loadMoreMangas(1); } public void loadMoreMangas(int page) { + if (page > 1) { + view.showGridProgressBar(); + } if (mSearchMode) { getMangasFromSearch(page); } else { diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/CatalogueListActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/CatalogueListActivity.java index 91ab95f62..977eb369a 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/activity/CatalogueListActivity.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/CatalogueListActivity.java @@ -7,6 +7,7 @@ import android.view.Menu; import android.view.View; import android.widget.GridView; import android.widget.ImageView; +import android.widget.ProgressBar; import butterknife.Bind; import butterknife.ButterKnife; @@ -24,6 +25,12 @@ public class CatalogueListActivity extends BaseActivity implements CatalogueList @Bind(R.id.gridView) GridView manga_list; + @Bind(R.id.progress) + ProgressBar progress; + + @Bind(R.id.progress_grid) + ProgressBar progress_grid; + private CatalogueListPresenter presenter; private EndlessScrollListener scrollListener; @@ -100,6 +107,22 @@ public class CatalogueListActivity extends BaseActivity implements CatalogueList scrollListener.resetScroll(); } + @Override + public void showProgressBar() { + progress.setVisibility(ProgressBar.VISIBLE); + } + + @Override + public void showGridProgressBar() { + progress_grid.setVisibility(ProgressBar.VISIBLE); + } + + @Override + public void hideProgressBar() { + progress.setVisibility(ProgressBar.GONE); + progress_grid.setVisibility(ProgressBar.GONE); + } + @Override public ImageView getImageView(int position) { View v = manga_list.getChildAt(position - diff --git a/app/src/main/java/eu/kanade/mangafeed/view/CatalogueListView.java b/app/src/main/java/eu/kanade/mangafeed/view/CatalogueListView.java index 8a16b56a7..6a1aa9949 100644 --- a/app/src/main/java/eu/kanade/mangafeed/view/CatalogueListView.java +++ b/app/src/main/java/eu/kanade/mangafeed/view/CatalogueListView.java @@ -11,5 +11,8 @@ public interface CatalogueListView extends BaseView { void setAdapter(EasyAdapter adapter); void setScrollListener(); void resetScrollListener(); + void showProgressBar(); + void showGridProgressBar(); + void hideProgressBar(); ImageView getImageView(int position); } diff --git a/app/src/main/res/layout/activity_catalogue_list.xml b/app/src/main/res/layout/activity_catalogue_list.xml index 94691010d..9442f64c9 100644 --- a/app/src/main/res/layout/activity_catalogue_list.xml +++ b/app/src/main/res/layout/activity_catalogue_list.xml @@ -11,9 +11,18 @@ android:id="@+id/toolbar" layout="@layout/toolbar"/> + + + +