parse stt on partial results
This commit is contained in:
		
							
								
								
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							| @ -29,7 +29,7 @@ | |||||||
|       </value> |       </value> | ||||||
|     </option> |     </option> | ||||||
|   </component> |   </component> | ||||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||||||
|     <output url="file://$PROJECT_DIR$/build/classes" /> |     <output url="file://$PROJECT_DIR$/build/classes" /> | ||||||
|   </component> |   </component> | ||||||
|   <component name="ProjectType"> |   <component name="ProjectType"> | ||||||
|  | |||||||
| @ -46,19 +46,14 @@ class SttDialog : DialogFragment() { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         override fun onPartialResults(data: Bundle) { |         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 { |             matchActivity?.apply { | ||||||
|                 matchModel?.apply { |                 matchModel?.apply { | ||||||
|  |                     data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results -> | ||||||
|                         for (result in results) { |                         for (result in results) { | ||||||
|  |                             partialResultsTextView?.text = result | ||||||
|                             for (player in players) { |                             for (player in players) { | ||||||
|                                 if (player.pattern?.matcher(result)?.find() == true) { |                                 if (player.pattern?.matcher(result)?.find() == true) { | ||||||
|  |                                     stt?.stopListening() | ||||||
|                                     dismiss() |                                     dismiss() | ||||||
|                                     updateScore(player) |                                     updateScore(player) | ||||||
|                                     updateUI() |                                     updateUI() | ||||||
| @ -66,12 +61,15 @@ class SttDialog : DialogFragment() { | |||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         override fun onResults(data: Bundle) { | ||||||
|             partialResultsTextView?.text = getString(R.string.not_understood) |             partialResultsTextView?.text = getString(R.string.not_understood) | ||||||
|             onError(ERROR_NOT_UNDERSTOOD) |             onError(ERROR_NOT_UNDERSTOOD) | ||||||
|         } |         } | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         override fun onEndOfSpeech() {} |         override fun onEndOfSpeech() {} | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user