small changes

This commit is contained in:
adrienmalin 2018-12-17 17:23:17 +01:00
parent 0dcef96194
commit 6a51441c0f
8 changed files with 11 additions and 12 deletions

Binary file not shown.

2
.idea/misc.xml generated
View File

@ -29,7 +29,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

Binary file not shown.

View File

@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":4,"versionName":"2.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":5,"versionName":"2.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

View File

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

View File

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

View File

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