mirror of
				https://github.com/SimpleMobileTools/Simple-Gallery.git
				synced 2025-06-05 21:59:19 +02:00 
			
		
		
		
	play the video at load automatically if set so, fixes #38
This commit is contained in:
		@@ -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();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user