bug fix
This commit is contained in:
parent
0bfb13f678
commit
ff57c29ce1
@ -131,7 +131,7 @@ class MatchActivity : AppCompatActivity() {
|
||||
|
||||
if (matchFinished) {
|
||||
val (loser, winner) = players.sortedBy { it.score }
|
||||
if (sttEnabled) {
|
||||
if (ttsEnabled) {
|
||||
speakText(
|
||||
getString(
|
||||
R.string.victory_speech,
|
||||
|
@ -36,6 +36,7 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
|
||||
override fun onPartialResults(data: Bundle) {
|
||||
if (!data.isEmpty)
|
||||
partialResultsTextView?.text = data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)[0]
|
||||
}
|
||||
|
||||
@ -77,18 +78,15 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?) = AlertDialog.Builder(activity).apply {
|
||||
val view: View = (context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(
|
||||
R.layout.dialog_stt,
|
||||
null
|
||||
)
|
||||
partialResultsTextView = view.findViewById(R.id.partialResultTextView)
|
||||
icStt = view.findViewById(R.id.icStt)
|
||||
(context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(R.layout.dialog_stt, null). apply {
|
||||
partialResultsTextView = findViewById(R.id.partialResultTextView)
|
||||
icStt = findViewById(R.id.icStt)
|
||||
|
||||
setView(view)
|
||||
setView(this)
|
||||
|
||||
matchActivity = (activity as MatchActivity).apply {
|
||||
matchModel?.apply {
|
||||
view.findViewById<TextView>(R.id.sttHintTextView).text = getString(
|
||||
findViewById<TextView>(R.id.sttHintTextView).text = getString(
|
||||
R.string.STT_hint,
|
||||
players[0].name,
|
||||
players[1].name
|
||||
@ -112,6 +110,7 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.create()!!
|
||||
|
||||
override fun onStop() {
|
||||
|
@ -40,9 +40,6 @@
|
||||
<string name="STT_hint">Say: \"Point for %s\"\nor \"Point for %s\"</string>
|
||||
<string name="pattern">(?i:Point for %s)</string>
|
||||
<string name="not_understood">Can you repeat, please?</string>
|
||||
<string name="score" translatable="false">%d - %d</string>
|
||||
<string name="score" translatable="false">%2d - %2d</string>
|
||||
<string name="STT_disabled">Voice recognition disabled.</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user