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