Merge pull request #275 from Pangoraw/master
Add loader when waiting to display a media, closes #196
This commit is contained in:
commit
bc7ac41a28
4 changed files with 16 additions and 1 deletions
|
@ -20,13 +20,16 @@ import android.os.Bundle;
|
|||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.MediaController;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class ViewVideoActivity extends BaseActivity {
|
||||
@BindView(R.id.video_progress) ProgressBar progressBar;
|
||||
@BindView(R.id.video_player) VideoView videoView;
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
|
||||
|
@ -56,6 +59,7 @@ public class ViewVideoActivity extends BaseActivity {
|
|||
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
||||
@Override
|
||||
public void onPrepared(MediaPlayer mp) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
mp.setLooping(true);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ViewMediaFragment extends DialogFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, final ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_view_media, container, false);
|
||||
final View rootView = inflater.inflate(R.layout.fragment_view_media, container, false);
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
Bundle arguments = getArguments();
|
||||
|
@ -141,6 +141,7 @@ public class ViewMediaFragment extends DialogFragment {
|
|||
.into(photoView, new Callback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
rootView.findViewById(R.id.view_media_progress).setVisibility(View.GONE);
|
||||
attacher.update();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true" />
|
||||
<ProgressBar
|
||||
android:id="@+id/video_progress"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
android:clickable="true"
|
||||
android:layout_gravity="center"
|
||||
android:background="@android:color/black">
|
||||
<ProgressBar
|
||||
android:id="@+id/view_media_progress"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<uk.co.senab.photoview.PhotoView
|
||||
android:id="@+id/view_media_image"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue