play the video at load automatically if set so, fixes #38
This commit is contained in:
parent
6e0f60b770
commit
4f289b4c47
|
@ -23,6 +23,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.simplemobiletools.gallery.Config;
|
||||||
import com.simplemobiletools.gallery.Constants;
|
import com.simplemobiletools.gallery.Constants;
|
||||||
import com.simplemobiletools.gallery.R;
|
import com.simplemobiletools.gallery.R;
|
||||||
import com.simplemobiletools.gallery.Utils;
|
import com.simplemobiletools.gallery.Utils;
|
||||||
|
@ -52,6 +53,7 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
private boolean mIsPlaying;
|
private boolean mIsPlaying;
|
||||||
private boolean mIsDragged;
|
private boolean mIsDragged;
|
||||||
private boolean mIsFullscreen;
|
private boolean mIsFullscreen;
|
||||||
|
private boolean mIsFragmentVisible;
|
||||||
private int mCurrTime;
|
private int mCurrTime;
|
||||||
private int mDuration;
|
private int mDuration;
|
||||||
|
|
||||||
|
@ -87,6 +89,17 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
initTimeHolder();
|
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() {
|
public void itemDragged() {
|
||||||
pauseVideo();
|
pauseVideo();
|
||||||
}
|
}
|
||||||
|
@ -255,6 +268,7 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
pauseVideo();
|
pauseVideo();
|
||||||
|
mIsFragmentVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -394,5 +408,8 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
addPreviewImage();
|
addPreviewImage();
|
||||||
setupTimeHolder();
|
setupTimeHolder();
|
||||||
setProgress(mCurrTime);
|
setProgress(mCurrTime);
|
||||||
|
|
||||||
|
if (mIsFragmentVisible)
|
||||||
|
playVideo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue