small changes
This commit is contained in:
		| @ -30,7 +30,7 @@ class MatchActivity : AppCompatActivity() { | ||||
|  | ||||
|     inner class SttAfterTts : UtteranceProgressListener() { | ||||
|         override fun onDone(id: String) { | ||||
|             SttDialog().show( supportFragmentManager, "SttDialog") | ||||
|             SttDialog().show(supportFragmentManager, "SttDialog") | ||||
|         } | ||||
|  | ||||
|         override fun onStart(id: String) {} | ||||
| @ -69,7 +69,10 @@ class MatchActivity : AppCompatActivity() { | ||||
|                     sttEnabled = getBooleanExtra("enableSTT", false) | ||||
|                     saveState() | ||||
|  | ||||
|                     if (ttsEnabled) tts = TextToSpeech(this@MatchActivity, WaitForTtsInit()) | ||||
|                     if (ttsEnabled) { | ||||
|                         tts = TextToSpeech(this@MatchActivity, WaitForTtsInit()) | ||||
|                         if (sttEnabled) tts?.setOnUtteranceProgressListener(SttAfterTts()) | ||||
|                     } | ||||
|                     if (!sttEnabled) showPopUp(getString(R.string.button_hint)) | ||||
|                 } | ||||
|             } | ||||
| @ -127,10 +130,7 @@ class MatchActivity : AppCompatActivity() { | ||||
|                     if (matchPoint) scoreSpeech += getString(R.string.match_point) | ||||
|                     say(scoreSpeech) | ||||
|                 } | ||||
|                 if (sttEnabled) { | ||||
|                     if (ttsEnabled) tts?.setOnUtteranceProgressListener(SttAfterTts()) | ||||
|                     else SttDialog().show(supportFragmentManager, "SttDialog") | ||||
|                 } | ||||
|                 if (sttEnabled and !ttsEnabled) SttDialog().show(supportFragmentManager, "SttDialog") | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -1,9 +1,7 @@ | ||||
| package adrienmalin.pingpoints | ||||
|  | ||||
| import java.util.regex.Pattern | ||||
|  | ||||
| data class Player ( | ||||
|     var name: String, | ||||
|     var score: Int, | ||||
|     var pattern: Pattern? = null | ||||
|     var soundex:String? = null | ||||
| ) | ||||
| @ -99,10 +99,11 @@ class SttDialog : DialogFragment() { | ||||
|                         players[1].name | ||||
|                     ) | ||||
|                     sttIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply { | ||||
|                         putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) | ||||
|                         putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH) | ||||
|                         putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 10) | ||||
|                         putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true) | ||||
|                         putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true) | ||||
|                         putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 30000) | ||||
|                     } | ||||
|                     stt = SpeechRecognizer.createSpeechRecognizer(activity).apply { | ||||
|                         setRecognitionListener(SttListener()) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user