From 8a840a6951478fab5110bf49301e36b6e8eb3412 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 05ec430e..9f1c4bf0 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 9a5dbee2..f251743f 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 79b1207e..7a15f215 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" /> + +