From 08f7a57c55d039de82939e5b2a58d1cf15274937 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 25 Sep 2016 23:16:34 +0200 Subject: [PATCH] prevent the screen from turning off while playing a video --- .../com/simplemobiletools/gallery/fragments/VideoFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java b/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java index 57e24cddc..0fbdb60f8 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java +++ b/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java @@ -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); } }