mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 14:28:00 +01:00
prevent the screen from turning off while playing a video
This commit is contained in:
parent
e57242374b
commit
08f7a57c55
1 changed files with 3 additions and 0 deletions
|
@ -16,6 +16,7 @@ import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -199,12 +200,14 @@ public class VideoFragment extends ViewPagerFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
mPlayOutline.setImageDrawable(null);
|
mPlayOutline.setImageDrawable(null);
|
||||||
|
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
} else {
|
} else {
|
||||||
if (mMediaPlayer != null) {
|
if (mMediaPlayer != null) {
|
||||||
mMediaPlayer.pause();
|
mMediaPlayer.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
mPlayOutline.setImageDrawable(getResources().getDrawable(R.mipmap.play_outline_big));
|
mPlayOutline.setImageDrawable(getResources().getDrawable(R.mipmap.play_outline_big));
|
||||||
|
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue