app/src/main/java/com/example/jarvis_stts/MainActivity.kt aktualisiert
This commit is contained in:
@@ -46,15 +46,13 @@ class MainActivity : AppCompatActivity(), RecognitionListener, TextToSpeech.OnIn
|
|||||||
private val speechRecognizerLauncher = registerForActivityResult(
|
private val speechRecognizerLauncher = registerForActivityResult(
|
||||||
ActivityResultContracts.StartActivityForResult()
|
ActivityResultContracts.StartActivityForResult()
|
||||||
) { result ->
|
) { result ->
|
||||||
// WICHTIG: Nach der Google-Eingabe starten wir Vosk wieder
|
isInteracting = false // WICHTIG: Sperre wieder aufheben!
|
||||||
|
|
||||||
if (result.resultCode == RESULT_OK && result.data != null) {
|
if (result.resultCode == RESULT_OK && result.data != null) {
|
||||||
val spokenText = result.data!!.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)?.get(0) ?: ""
|
val spokenText = result.data!!.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)?.get(0) ?: ""
|
||||||
tvStatus.text = "Ich: $spokenText"
|
tvStatus.text = "Ich: $spokenText"
|
||||||
webSocket?.send(spokenText)
|
webSocket?.send(spokenText)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vosk wieder starten, nachdem Google fertig ist
|
|
||||||
isInteracting = false
|
|
||||||
startVosk()
|
startVosk()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user