play the video at load automatically if set so, fixes #38
This commit is contained in:
parent
6e0f60b770
commit
4f289b4c47
1 changed files with 17 additions and 0 deletions
|
@ -23,6 +23,7 @@ import android.widget.ImageView;
|
|||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.simplemobiletools.gallery.Config;
|
||||
import com.simplemobiletools.gallery.Constants;
|
||||
import com.simplemobiletools.gallery.R;
|
||||
import com.simplemobiletools.gallery.Utils;
|
||||
|
@ -52,6 +53,7 @@ public class VideoFragment extends ViewPagerFragment
|
|||
private boolean mIsPlaying;
|
||||
private boolean mIsDragged;
|
||||
private boolean mIsFullscreen;
|
||||
private boolean mIsFragmentVisible;
|
||||
private int mCurrTime;
|
||||
private int mDuration;
|
||||
|
||||
|
@ -87,6 +89,17 @@ public class VideoFragment extends ViewPagerFragment
|
|||
initTimeHolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMenuVisibility(boolean menuVisible) {
|
||||
super.setMenuVisibility(menuVisible);
|
||||
mIsFragmentVisible = menuVisible;
|
||||
if (menuVisible) {
|
||||
if (getContext() != null && Config.newInstance(getContext()).getAutoplayVideos()) {
|
||||
playVideo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void itemDragged() {
|
||||
pauseVideo();
|
||||
}
|
||||
|
@ -255,6 +268,7 @@ public class VideoFragment extends ViewPagerFragment
|
|||
public void onPause() {
|
||||
super.onPause();
|
||||
pauseVideo();
|
||||
mIsFragmentVisible = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -394,5 +408,8 @@ public class VideoFragment extends ViewPagerFragment
|
|||
addPreviewImage();
|
||||
setupTimeHolder();
|
||||
setProgress(mCurrTime);
|
||||
|
||||
if (mIsFragmentVisible)
|
||||
playVideo();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue