mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Merge pull request #913 from Bluesir9/fix_374_download_my_uploads_loader
Added progressbar in ContributionsListFragment to be shown while its loading contributions
This commit is contained in:
commit
09fa46526c
3 changed files with 18 additions and 9 deletions
|
|
@ -238,6 +238,8 @@ public class ContributionsActivity extends AuthenticatedActivity
|
|||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
|
||||
contributionsList.changeProgressBarVisibility(false);
|
||||
|
||||
if (contributionsList.getAdapter() == null) {
|
||||
contributionsList.setAdapter(new ContributionsListAdapter(getApplicationContext(),
|
||||
cursor, 0));
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
|
@ -41,8 +42,9 @@ public class ContributionsListFragment extends Fragment {
|
|||
GridView contributionsList;
|
||||
@BindView(R.id.waitingMessage)
|
||||
TextView waitingMessage;
|
||||
@BindView(R.id.emptyMessage)
|
||||
TextView emptyMessage;
|
||||
@BindView(R.id.loadingContributionsProgressBar)
|
||||
ProgressBar progressBar;
|
||||
|
||||
private ContributionController controller;
|
||||
|
||||
@Override
|
||||
|
|
@ -67,6 +69,7 @@ public class ContributionsListFragment extends Fragment {
|
|||
waitingMessage.setVisibility(GONE);
|
||||
}
|
||||
|
||||
changeProgressBarVisibility(true);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +81,10 @@ public class ContributionsListFragment extends Fragment {
|
|||
this.contributionsList.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public void changeProgressBarVisibility(boolean isVisible) {
|
||||
this.progressBar.setVisibility(isVisible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
if (outState == null) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
@ -13,15 +14,14 @@
|
|||
android:id="@+id/waitingMessage"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_uploads_yet"
|
||||
android:id="@+id/emptyMessage"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_centerInParent="true"
|
||||
android:id="@+id/loadingContributionsProgressBar"
|
||||
/>
|
||||
|
||||
<GridView
|
||||
|
|
@ -36,4 +36,4 @@
|
|||
android:fastScrollEnabled="true"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue