🚀 Keep screen awake in Reader
Now screen will never fade in Reader, allowing users with small screen timeout delay to read comfortably. Resolves: #54
This commit is contained in:
parent
b2f8000e1a
commit
cd583f56d4
1 changed files with 5 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import android.app.SearchManager
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.view.WindowManager
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.compose.runtime.snapshotFlow
|
import androidx.compose.runtime.snapshotFlow
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
|
|
@ -225,6 +226,7 @@ class ReaderViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
insetsController.show(WindowInsetsCompat.Type.systemBars())
|
insetsController.show(WindowInsetsCompat.Type.systemBars())
|
||||||
|
event.context.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
event.navigate()
|
event.navigate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -472,6 +474,9 @@ class ReaderViewModel @Inject constructor(
|
||||||
|
|
||||||
clear()
|
clear()
|
||||||
launch {
|
launch {
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
|
context.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
}.join()
|
||||||
onEvent(ReaderEvent.OnShowHideMenu(false, context))
|
onEvent(ReaderEvent.OnShowHideMenu(false, context))
|
||||||
onEvent(
|
onEvent(
|
||||||
ReaderEvent.OnLoadText(
|
ReaderEvent.OnLoadText(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue