parse stt on partial results
This commit is contained in:
@ -46,19 +46,14 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
|
||||
override fun onPartialResults(data: Bundle) {
|
||||
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
|
||||
if (results.isNotEmpty())
|
||||
partialResultsTextView?.text = results[0]
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResults(data: Bundle) {
|
||||
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
|
||||
matchActivity?.apply {
|
||||
matchModel?.apply {
|
||||
matchActivity?.apply {
|
||||
matchModel?.apply {
|
||||
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
|
||||
for (result in results) {
|
||||
partialResultsTextView?.text = result
|
||||
for (player in players) {
|
||||
if (player.pattern?.matcher(result)?.find() == true) {
|
||||
stt?.stopListening()
|
||||
dismiss()
|
||||
updateScore(player)
|
||||
updateUI()
|
||||
@ -66,13 +61,16 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
partialResultsTextView?.text = getString(R.string.not_understood)
|
||||
onError(ERROR_NOT_UNDERSTOOD)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResults(data: Bundle) {
|
||||
partialResultsTextView?.text = getString(R.string.not_understood)
|
||||
onError(ERROR_NOT_UNDERSTOOD)
|
||||
}
|
||||
|
||||
override fun onEndOfSpeech() {}
|
||||
|
||||
override fun onError(errorCode: Int) {
|
||||
|
Reference in New Issue
Block a user