Fix STT stopping after 5s of silence
This commit is contained in:
parent
fcb2b90999
commit
9d9eaef88d
@ -56,6 +56,7 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
partialResultsTextView?.text = getString(R.string.not_understood)
|
||||
onError(ERROR_NOT_UNDERSTOOD)
|
||||
}
|
||||
}
|
||||
@ -63,15 +64,17 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
|
||||
override fun onError(errorCode: Int) {
|
||||
partialResultsTextView?.text = getString(R.string.not_understood)
|
||||
stt?.startListening(sttIntent)
|
||||
stt = SpeechRecognizer.createSpeechRecognizer(activity).apply {
|
||||
setRecognitionListener(SttListener())
|
||||
startListening(sttIntent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEvent(arg0: Int, arg1: Bundle?) {}
|
||||
override fun onReadyForSpeech(arg0: Bundle?) {}
|
||||
override fun onBeginningOfSpeech() {}
|
||||
override fun onBufferReceived(buffer: ByteArray?) {}
|
||||
override fun onEndOfSpeech() {}
|
||||
override fun onEvent(arg0: Int, arg1: Bundle?) {}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?) = AlertDialog.Builder(activity).apply {
|
||||
@ -115,5 +118,4 @@ class SttDialog : DialogFragment() {
|
||||
stt?.stopListening()
|
||||
stt?.destroy()
|
||||
}
|
||||
|
||||
}
|
@ -41,7 +41,7 @@ class VictoryActivity : AppCompatActivity() {
|
||||
)
|
||||
)
|
||||
|
||||
previousMatches = previousMatch.getString("previousMatches", "")
|
||||
previousMatches = previousMatch.getString("previousMatches", "") ?: ""
|
||||
previousMatch.edit().apply {
|
||||
putString(
|
||||
"previousMatches",
|
||||
|
Loading…
x
Reference in New Issue
Block a user