mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Progressbar in category and media fragment now doesn't overlaps the views (#2382)
* graddle changes * scrolling fixed for both media and category
This commit is contained in:
parent
535e93aa64
commit
2cd375a11b
3 changed files with 31 additions and 9 deletions
|
|
@ -57,6 +57,8 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
|
|||
@BindView(R.id.imagesNotFound)
|
||||
TextView categoriesNotFoundView;
|
||||
String query;
|
||||
@BindView(R.id.bottomProgressBar)
|
||||
ProgressBar bottomProgressBar;
|
||||
|
||||
@Inject RecentSearchesDao recentSearchesDao;
|
||||
@Inject MediaWikiApi mwApi;
|
||||
|
|
@ -128,7 +130,8 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
|
|||
handleNoInternet();
|
||||
return;
|
||||
}
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
bottomProgressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(GONE);
|
||||
queryList.clear();
|
||||
categoriesAdapter.clear();
|
||||
Observable.fromCallable(() -> mwApi.searchCategory(query,queryList.size()))
|
||||
|
|
@ -144,7 +147,8 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
|
|||
*/
|
||||
public void addCategoriesToList(String query) {
|
||||
this.query = query;
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
bottomProgressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(GONE);
|
||||
Observable.fromCallable(() -> mwApi.searchCategory(query,queryList.size()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
@ -160,6 +164,7 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
|
|||
private void handlePaginationSuccess(List<String> mediaList) {
|
||||
queryList.addAll(mediaList);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
bottomProgressBar.setVisibility(GONE);
|
||||
categoriesAdapter.addAll(mediaList);
|
||||
categoriesAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
|
@ -178,7 +183,8 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
|
|||
}
|
||||
else {
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
bottomProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setVisibility(GONE);
|
||||
categoriesAdapter.addAll(mediaList);
|
||||
categoriesAdapter.notifyDataSetChanged();
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
|
|||
@BindView(R.id.imagesNotFound)
|
||||
TextView imagesNotFoundView;
|
||||
String query;
|
||||
@BindView(R.id.bottomProgressBar)
|
||||
ProgressBar bottomProgressBar;
|
||||
|
||||
@Inject RecentSearchesDao recentSearchesDao;
|
||||
@Inject MediaWikiApi mwApi;
|
||||
|
|
@ -135,6 +137,7 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
|
|||
return;
|
||||
}
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
bottomProgressBar.setVisibility(GONE);
|
||||
queryList.clear();
|
||||
imagesAdapter.clear();
|
||||
Observable.fromCallable(() -> mwApi.searchImages(query,queryList.size()))
|
||||
|
|
@ -151,7 +154,8 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
|
|||
@SuppressLint("CheckResult")
|
||||
public void addImagesToList(String query) {
|
||||
this.query = query;
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
bottomProgressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(GONE);
|
||||
Observable.fromCallable(() -> mwApi.searchImages(query,queryList.size()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
|
@ -166,6 +170,7 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
|
|||
*/
|
||||
private void handlePaginationSuccess(List<Media> mediaList) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
bottomProgressBar.setVisibility(GONE);
|
||||
if (mediaList.size() != 0 || !queryList.get(queryList.size() - 1).getFilename().equals(mediaList.get(mediaList.size() - 1).getFilename())) {
|
||||
queryList.addAll(mediaList);
|
||||
imagesAdapter.addAll(mediaList);
|
||||
|
|
@ -187,8 +192,8 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
|
|||
initErrorView();
|
||||
}
|
||||
else {
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
bottomProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setVisibility(GONE);
|
||||
imagesAdapter.addAll(mediaList);
|
||||
imagesAdapter.notifyDataSetChanged();
|
||||
((SearchActivity)getContext()).viewPagerNotifyDataSetChanged();
|
||||
|
|
|
|||
|
|
@ -16,18 +16,29 @@
|
|||
android:layout_centerInParent="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/bottomProgressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<ProgressBar
|
||||
android:id="@+id/imageSearchInProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
/>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/imagesListBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_above="@+id/bottomProgressBar"
|
||||
android:scrollbarSize="@dimen/standard_gap"
|
||||
android:fadingEdge="none" />
|
||||
|
||||
</RelativeLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue