Jelajahi Sumber

1.添加获取mmse试题库UI跳转

王鹏鹏 2 tahun lalu
induk
melakukan
0a7c9953a5

+ 56 - 31
mmse/src/main/java/com/yingyangfly/mmse/fragment/MultipleChoiceFragment.kt

@@ -1,6 +1,7 @@
 package com.yingyangfly.mmse.fragment
 
 import android.os.Bundle
+import android.text.TextUtils
 import androidx.core.os.bundleOf
 import androidx.navigation.Navigation
 import com.yingyang.mmse.R
@@ -31,6 +32,11 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>() {
 
     override fun initViews() {
         binding {
+            binding.tvTitle.text = if (questionId == 19) {
+                "还记得刚才让您记住的那三个词吗?请您再说一遍"
+            } else {
+                "现在您将听到三个词,全部听完之后请您重复说一遍。请记住这三个词,过一会还要问您"
+            }
             rvChoice.adapter = adapter
             adapter.onNumClickListener = { bean ->
                 if (dao != null) {
@@ -43,49 +49,61 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>() {
     override fun initListener() {
         binding {
             btnPrevious.setOnSingleClickListener {
-                if (questionId == 26) {
-                    val bundle = bundleOf("questionId" to questionId)
-                    val controller = Navigation.findNavController(it)
-                    controller.navigate(
-                        R.id.action_multipleChoiceFragment_to_recordActionFragment,
-                        bundle
-                    )
-                } else if (questionId == 19) {
-
-
-                } else {
-                    val bundle = bundleOf("questionId" to 11)
-                    val controller = Navigation.findNavController(it)
-                    controller.navigate(
-                        R.id.action_multipleChoiceFragment_to_soundRecordFragment,
-                        bundle
-                    )
-                }
-            }
-            btnNext.setOnSingleClickListener {
-                if (judge()) {
-                    if (questionId == 26) {
-                        val bundle = Bundle()
-                        bundle.putInt("questionId", 29)
+                when (questionId) {
+                    26 -> {
+                        val bundle = bundleOf("questionId" to questionId)
                         val controller = Navigation.findNavController(it)
                         controller.navigate(
-                            R.id.action_multipleChoiceFragment_to_judgmentFragment,
+                            R.id.action_multipleChoiceFragment_to_recordActionFragment,
+                            bundle
+                        )
+                    }
+                    19 -> {
+                        val bundle = bundleOf("questionId" to 30)
+                        val controller = Navigation.findNavController(it)
+                        controller.navigate(
+                            R.id.action_multipleChoiceFragment_to_recordActionFragment,
                             bundle
                         )
-                    } else if (questionId == 19) {
-
 
-                    } else {
-                        val bundle = Bundle()
-                        bundle.putInt("questionId", 14)
+                    }
+                    else -> {
+                        val bundle = bundleOf("questionId" to 11)
                         val controller = Navigation.findNavController(it)
                         controller.navigate(
-                            R.id.action_multipleChoiceFragment_to_countFragment,
+                            R.id.action_multipleChoiceFragment_to_soundRecordFragment,
                             bundle
                         )
                     }
                 }
             }
+            btnNext.setOnSingleClickListener {
+                if (judge()) {
+                    when (questionId) {
+                        26 -> {
+                            val bundle = Bundle()
+                            bundle.putInt("questionId", 29)
+                            val controller = Navigation.findNavController(it)
+                            controller.navigate(
+                                R.id.action_multipleChoiceFragment_to_judgmentFragment,
+                                bundle
+                            )
+                        }
+                        19 -> {
+                            submit()
+                        }
+                        else -> {
+                            val bundle = Bundle()
+                            bundle.putInt("questionId", 14)
+                            val controller = Navigation.findNavController(it)
+                            controller.navigate(
+                                R.id.action_multipleChoiceFragment_to_countFragment,
+                                bundle
+                            )
+                        }
+                    }
+                }
+            }
         }
     }
 
@@ -136,4 +154,11 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>() {
         }
         return true
     }
+
+    /**
+     * 提交测试
+     */
+    private fun submit() {
+
+    }
 }