show progress while loading media files

This commit is contained in:
Christian Schneppe 2019-03-06 21:39:11 +01:00
parent d450fe5113
commit d393a18232
3 changed files with 20 additions and 1 deletions

View file

@ -51,6 +51,8 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded
mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
this.binding.media.setAdapter(mMediaAdapter);
GridManager.setupLayoutManager(this, this.binding.media, R.dimen.browser_media_size);
this.binding.noMedia.setVisibility(View.GONE);
this.binding.progressbar.setVisibility(View.VISIBLE);
}
@Override
@ -74,8 +76,10 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded
if (attachments.size() > 0) {
mMediaAdapter.setAttachments(attachments);
this.binding.noMedia.setVisibility(View.GONE);
this.binding.progressbar.setVisibility(View.GONE);
} else {
this.binding.noMedia.setVisibility(View.VISIBLE);
this.binding.progressbar.setVisibility(View.GONE);
}
});
}

View file

@ -20,6 +20,21 @@
android:padding="2dp"
android:scrollbars="vertical" />
<RelativeLayout
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center" />
</RelativeLayout>
<TextView
android:id="@+id/no_media"
android:layout_width="match_parent"

View file

@ -98,7 +98,7 @@
<item
android:id="@+id/action_mediabrowser"
android:icon="@drawable/ic_image_white_24dp"
android:orderInCategory="100"
android:orderInCategory="1"
android:title="@string/media_browser"
app:showAsAction="always" />
</menu>