|
@@ -43,24 +43,39 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>() {
|
|
|
override fun initListener() {
|
|
|
binding {
|
|
|
btnPrevious.setOnSingleClickListener {
|
|
|
- val bundle = bundleOf("questionId" to questionId)
|
|
|
- val controller = Navigation.findNavController(it)
|
|
|
- controller.navigate(
|
|
|
- R.id.action_multipleChoiceFragment_to_soundRecordFragment,
|
|
|
- bundle
|
|
|
- )
|
|
|
- }
|
|
|
- btnNext.setOnSingleClickListener {
|
|
|
- if (judge()) {
|
|
|
- val bundle = Bundle()
|
|
|
- bundle.putInt("questionId", 14)
|
|
|
+ if (questionId == 26) {
|
|
|
+ val controller = Navigation.findNavController(it)
|
|
|
+ controller.navigate(R.id.action_multipleChoiceFragment_to_recordActionFragment)
|
|
|
+ } else {
|
|
|
+ val bundle = bundleOf("questionId" to questionId)
|
|
|
val controller = Navigation.findNavController(it)
|
|
|
controller.navigate(
|
|
|
- R.id.action_multipleChoiceFragment_to_countFragment,
|
|
|
+ R.id.action_multipleChoiceFragment_to_soundRecordFragment,
|
|
|
bundle
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
+ btnNext.setOnSingleClickListener {
|
|
|
+ if (judge()) {
|
|
|
+ if (questionId == 26) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt("questionId", 29)
|
|
|
+ val controller = Navigation.findNavController(it)
|
|
|
+ controller.navigate(
|
|
|
+ R.id.action_multipleChoiceFragment_to_judgmentFragment,
|
|
|
+ bundle
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt("questionId", 14)
|
|
|
+ val controller = Navigation.findNavController(it)
|
|
|
+ controller.navigate(
|
|
|
+ R.id.action_multipleChoiceFragment_to_countFragment,
|
|
|
+ bundle
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -79,15 +94,17 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>() {
|
|
|
private fun loadData() {
|
|
|
choiceItemList.clear()
|
|
|
if (dao != null) {
|
|
|
- val firstquestion = dao?.getQuestion(11)
|
|
|
+ val firstquestion = dao?.getQuestion(questionId)
|
|
|
if (firstquestion != null) {
|
|
|
choiceItemList.add(firstquestion)
|
|
|
}
|
|
|
- val secondQuestion = dao?.getQuestion(12)
|
|
|
+ val secondQuestionnId = questionId + 1
|
|
|
+ val secondQuestion = dao?.getQuestion(secondQuestionnId)
|
|
|
if (secondQuestion != null) {
|
|
|
choiceItemList.add(secondQuestion)
|
|
|
}
|
|
|
- val thirdQuestion = dao?.getQuestion(13)
|
|
|
+ val thirdQuestionId = questionId + 1
|
|
|
+ val thirdQuestion = dao?.getQuestion(thirdQuestionId)
|
|
|
if (thirdQuestion != null) {
|
|
|
choiceItemList.add(thirdQuestion)
|
|
|
}
|
|
@@ -100,17 +117,19 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>() {
|
|
|
*/
|
|
|
private fun judge(): Boolean {
|
|
|
if (dao != null) {
|
|
|
- val firstquestion = dao?.getQuestion(11)
|
|
|
+ val firstquestion = dao?.getQuestion(questionId)
|
|
|
if (firstquestion != null && firstquestion.inputString.isNullOrEmpty()) {
|
|
|
"请判断是否正确".toast()
|
|
|
return false
|
|
|
}
|
|
|
- val secondQuestion = dao?.getQuestion(12)
|
|
|
+ val secondQuestionnId = questionId + 1
|
|
|
+ val secondQuestion = dao?.getQuestion(secondQuestionnId)
|
|
|
if (secondQuestion != null && secondQuestion.inputString.isNullOrEmpty()) {
|
|
|
"请判断是否正确".toast()
|
|
|
return false
|
|
|
}
|
|
|
- val thirdQuestion = dao?.getQuestion(13)
|
|
|
+ val thirdQuestionId = questionId + 1
|
|
|
+ val thirdQuestion = dao?.getQuestion(thirdQuestionId)
|
|
|
if (thirdQuestion != null && thirdQuestion.inputString.isNullOrEmpty()) {
|
|
|
"请判断是否正确".toast()
|
|
|
return false
|