mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Keep screen awake during voice input
This commit is contained in:
parent
601d6df6b3
commit
20f897aa56
@ -64,6 +64,7 @@ data class Action(
|
||||
@DrawableRes val icon: Int,
|
||||
@StringRes val name: Int,
|
||||
val canShowKeyboard: Boolean = false,
|
||||
val keepScreenAwake: Boolean = false,
|
||||
|
||||
val windowImpl: ((KeyboardManagerForAction, PersistentActionState?) -> ActionWindow)?,
|
||||
val simplePressImpl: ((KeyboardManagerForAction, PersistentActionState?) -> Unit)?,
|
||||
|
@ -7,6 +7,7 @@ import android.os.Build
|
||||
import android.os.VibrationEffect
|
||||
import android.os.Vibrator
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.InlineSuggestionsResponse
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
@ -230,6 +231,10 @@ class UixManager(private val latinIME: LatinIME) {
|
||||
|
||||
currWindowActionWindow = action.windowImpl?.let { it(keyboardManagerForAction, persistentStates[action]) }
|
||||
|
||||
if(action.keepScreenAwake) {
|
||||
latinIME.window.window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
setContent()
|
||||
}
|
||||
|
||||
@ -245,6 +250,8 @@ class UixManager(private val latinIME: LatinIME) {
|
||||
|
||||
latinIME.onKeyboardShown()
|
||||
|
||||
latinIME.window.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
|
||||
setContent()
|
||||
}
|
||||
|
||||
|
@ -244,6 +244,7 @@ private class VoiceInputActionWindow(
|
||||
val VoiceInputAction = Action(icon = R.drawable.mic_fill,
|
||||
name = R.string.voice_input_action_title,
|
||||
simplePressImpl = null,
|
||||
keepScreenAwake = true,
|
||||
persistentState = { VoiceInputPersistentState(it) },
|
||||
windowImpl = { manager, persistentState ->
|
||||
VoiceInputActionWindow(
|
||||
|
Loading…
Reference in New Issue
Block a user