mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Make full action window clickable
This commit is contained in:
parent
9f6941eff0
commit
8f53297eea
@ -1,5 +1,7 @@
|
|||||||
package org.futo.inputmethod.latin.uix.actions
|
package org.futo.inputmethod.latin.uix.actions
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
@ -7,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import org.futo.inputmethod.latin.R
|
import org.futo.inputmethod.latin.R
|
||||||
@ -71,7 +74,14 @@ val VoiceInputAction = Action(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun WindowContents() {
|
override fun WindowContents() {
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize().clickable(
|
||||||
|
enabled = true,
|
||||||
|
onClickLabel = null,
|
||||||
|
onClick = { recognizerView.finish() },
|
||||||
|
role = null,
|
||||||
|
indication = null,
|
||||||
|
interactionSource = remember { MutableInteractionSource() }
|
||||||
|
)) {
|
||||||
Box(modifier = Modifier.align(Alignment.Center)) {
|
Box(modifier = Modifier.align(Alignment.Center)) {
|
||||||
recognizerView.Content()
|
recognizerView.Content()
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,7 @@ class AudioRecognizer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun finish() {
|
fun finish() {
|
||||||
|
if(!isRecording) return
|
||||||
onFinishRecording()
|
onFinishRecording()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,10 @@ class RecognizerView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun finish() {
|
||||||
|
recognizer.finish()
|
||||||
|
}
|
||||||
|
|
||||||
fun cancel() {
|
fun cancel() {
|
||||||
recognizer.cancel()
|
recognizer.cancel()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user