|
|
@@ -19,12 +19,7 @@ class ListenRecordFragment : BaseFragment<FragmentListenRecordBinding>() {
|
|
|
*/
|
|
|
private var questionId = 0
|
|
|
private var playVoice: PlayVoice? = null
|
|
|
-
|
|
|
- private var firstWord = ""
|
|
|
- private var secondWord = ""
|
|
|
- private var thirdWord = ""
|
|
|
- private var fourthWord = ""
|
|
|
- private var fifthWord = ""
|
|
|
+ private val words = mutableListOf<String>()
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
questionId = arguments?.getInt("questionId") ?: 33
|
|
|
@@ -57,7 +52,7 @@ class ListenRecordFragment : BaseFragment<FragmentListenRecordBinding>() {
|
|
|
}
|
|
|
|
|
|
imagePlay.setOnSingleClickListener {
|
|
|
- playVoice?.speakWithParagraph(firstWord, secondWord, thirdWord)
|
|
|
+ playVoice?.speakWithParagraph(words)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -75,30 +70,31 @@ class ListenRecordFragment : BaseFragment<FragmentListenRecordBinding>() {
|
|
|
* 加载数据
|
|
|
*/
|
|
|
private fun loadData() {
|
|
|
+ words.clear()
|
|
|
if (dao != null) {
|
|
|
val firstquestion = dao?.getQuestion(questionId)
|
|
|
if (firstquestion != null) {
|
|
|
- firstWord = firstquestion.reviewItem
|
|
|
+ words.add(firstquestion.reviewItem)
|
|
|
}
|
|
|
val secondQuestionnId = questionId + 1
|
|
|
val secondQuestion = dao?.getQuestion(secondQuestionnId)
|
|
|
if (secondQuestion != null) {
|
|
|
- secondWord = secondQuestion.reviewItem
|
|
|
+ words.add(secondQuestion.reviewItem)
|
|
|
}
|
|
|
val thirdQuestionId = questionId + 2
|
|
|
val thirdQuestion = dao?.getQuestion(thirdQuestionId)
|
|
|
if (thirdQuestion != null) {
|
|
|
- thirdWord = thirdQuestion.reviewItem
|
|
|
+ words.add(thirdQuestion.reviewItem)
|
|
|
}
|
|
|
val fourthQuestionnId = questionId + 3
|
|
|
val fourthQuestion = dao?.getQuestion(fourthQuestionnId)
|
|
|
if (fourthQuestion != null) {
|
|
|
- fourthWord = fourthQuestion.reviewItem
|
|
|
+ words.add(fourthQuestion.reviewItem)
|
|
|
}
|
|
|
val fifthQuestionId = questionId + 4
|
|
|
val fifthQuestion = dao?.getQuestion(fifthQuestionId)
|
|
|
if (fifthQuestion != null) {
|
|
|
- fifthWord = fifthQuestion.reviewItem
|
|
|
+ words.add(fifthQuestion.reviewItem)
|
|
|
}
|
|
|
}
|
|
|
}
|