|
|
@@ -11,6 +11,7 @@ import com.yingyang.moca.databinding.FragmentVerifyAnswersBinding
|
|
|
import com.yingyangfly.baselib.base.BaseFragment
|
|
|
import com.yingyangfly.baselib.db.QuestionsBean
|
|
|
import com.yingyangfly.baselib.ext.setOnSingleClickListener
|
|
|
+import com.yingyangfly.baselib.ext.toast
|
|
|
import com.yingyangfly.baselib.utils.ImageUtil
|
|
|
import com.yingyangfly.moca.adapter.VerifyAnswersAdapter
|
|
|
|
|
|
@@ -50,12 +51,14 @@ class VerifyAnswersFragment : BaseFragment<FragmentVerifyAnswersBinding>() {
|
|
|
)
|
|
|
}
|
|
|
btnNext.setOnSingleClickListener {
|
|
|
- val controller = Navigation.findNavController(it)
|
|
|
- val bundle = bundleOf("questionId" to 41)
|
|
|
- controller.navigate(
|
|
|
- R.id.action_verifyAnswersFragment_to_identifyPictureFragment,
|
|
|
- bundle
|
|
|
- )
|
|
|
+ if (judge()) {
|
|
|
+ val controller = Navigation.findNavController(it)
|
|
|
+ val bundle = bundleOf("questionId" to 41)
|
|
|
+ controller.navigate(
|
|
|
+ R.id.action_verifyAnswersFragment_to_identifyPictureFragment,
|
|
|
+ bundle
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -94,4 +97,19 @@ class VerifyAnswersFragment : BaseFragment<FragmentVerifyAnswersBinding>() {
|
|
|
}
|
|
|
adapter.setData(choiceItemList)
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 非空判断
|
|
|
+ */
|
|
|
+ private fun judge(): Boolean {
|
|
|
+ if (choiceItemList.isNullOrEmpty().not()) {
|
|
|
+ choiceItemList.forEach {
|
|
|
+ if (it.inputString.isNullOrEmpty()) {
|
|
|
+ "请判断答案是否正确".toast()
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|