From fc2d039d634af6f28f03455fdca402220dd21bde Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 6 May 2017 11:30:52 +0000 Subject: [PATCH] Add loader when waiting to display a media --- .../main/java/com/keylesspalace/tusky/ViewVideoActivity.java | 4 ++++ .../com/keylesspalace/tusky/fragment/ViewMediaFragment.java | 3 ++- app/src/main/res/layout/activity_view_video.xml | 5 +++++ app/src/main/res/layout/fragment_view_media.xml | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewVideoActivity.java b/app/src/main/java/com/keylesspalace/tusky/ViewVideoActivity.java index 05ec430e2..9f1c4bf03 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ViewVideoActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ViewVideoActivity.java @@ -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); } }); diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewMediaFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewMediaFragment.java index 9a5dbee23..f251743fe 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewMediaFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewMediaFragment.java @@ -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(); } diff --git a/app/src/main/res/layout/activity_view_video.xml b/app/src/main/res/layout/activity_view_video.xml index 79b1207e7..7a15f215d 100644 --- a/app/src/main/res/layout/activity_view_video.xml +++ b/app/src/main/res/layout/activity_view_video.xml @@ -14,6 +14,11 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" /> + +