From 0ca5bbcbb41c043ae0b330bedaeb73741104e236 Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Tue, 29 Sep 2020 11:14:30 +0200 Subject: [PATCH] KEEP_SCREEN_ON in slideshow --- .../java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt index c8726c2..9ec2ebc 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/ImageViewer.kt @@ -7,6 +7,7 @@ import android.graphics.drawable.Drawable import android.os.Handler import android.view.MotionEvent import android.view.View +import android.view.WindowManager import android.widget.Toast import com.bumptech.glide.Glide import com.bumptech.glide.RequestBuilder @@ -155,6 +156,7 @@ class ImageViewer: FileViewerActivity() { Thread.sleep(ConstValues.slideshow_delay) } }.start() + window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) hideUI.run() Toast.makeText(this, R.string.slideshow_started, Toast.LENGTH_SHORT).show() } else { @@ -164,6 +166,7 @@ class ImageViewer: FileViewerActivity() { private fun stopSlideshow(){ slideshowActive = false + window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) Toast.makeText(this, R.string.slideshow_stopped, Toast.LENGTH_SHORT).show() }