mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-23 22:50:59 +01:00
prevent the screen from turning off while playing a video
This commit is contained in:
parent
e57242374b
commit
08f7a57c55
@ -16,6 +16,7 @@ import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
@ -199,12 +200,14 @@ public class VideoFragment extends ViewPagerFragment
|
||||
}
|
||||
|
||||
mPlayOutline.setImageDrawable(null);
|
||||
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
} else {
|
||||
if (mMediaPlayer != null) {
|
||||
mMediaPlayer.pause();
|
||||
}
|
||||
|
||||
mPlayOutline.setImageDrawable(getResources().getDrawable(R.mipmap.play_outline_big));
|
||||
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user