app/src/main/java/com/example/jarvis_stts/MainActivity.kt aktualisiert

This commit is contained in:
2026-03-11 16:33:42 +00:00
parent 7f7ffa6dc2
commit 9bbd0e9f84

View File

@@ -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()
} }