|
|
@@ -29,7 +29,7 @@ class InputFragment : BaseFragment<FragmentInputBinding>() {
|
|
|
var question: QuestionsBean? = null
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
- questionId = arguments?.getInt("questionId") ?: 4
|
|
|
+ questionId = arguments?.getInt("questionId") ?: 3
|
|
|
super.onCreate(savedInstanceState)
|
|
|
}
|
|
|
|
|
|
@@ -78,9 +78,13 @@ class InputFragment : BaseFragment<FragmentInputBinding>() {
|
|
|
//上一页
|
|
|
btnPrevious.setOnSingleClickListener { view ->
|
|
|
questionId--
|
|
|
- val bundle = bundleOf("questionId" to questionId)
|
|
|
- val controller = Navigation.findNavController(view)
|
|
|
- controller.navigate(R.id.action_inputFragment_to_selectedItemFragment, bundle)
|
|
|
+ if (questionId == 3) {
|
|
|
+ loadData()
|
|
|
+ } else {
|
|
|
+ val bundle = bundleOf("questionId" to questionId)
|
|
|
+ val controller = Navigation.findNavController(view)
|
|
|
+ controller.navigate(R.id.action_inputFragment_to_selectedItemFragment, bundle)
|
|
|
+ }
|
|
|
}
|
|
|
//下一页
|
|
|
btnNext.setOnSingleClickListener { view ->
|
|
|
@@ -95,10 +99,18 @@ class InputFragment : BaseFragment<FragmentInputBinding>() {
|
|
|
question!!.correct = ""
|
|
|
dao?.update(question!!)
|
|
|
}
|
|
|
- questionId++
|
|
|
- val bundle = bundleOf("questionId" to questionId)
|
|
|
- val controller = Navigation.findNavController(view)
|
|
|
- controller.navigate(R.id.action_inputFragment_to_selectedItemFragment, bundle)
|
|
|
+ if (questionId == 3) {
|
|
|
+ questionId++
|
|
|
+ loadData()
|
|
|
+ } else {
|
|
|
+ questionId++
|
|
|
+ val bundle = bundleOf("questionId" to questionId)
|
|
|
+ val controller = Navigation.findNavController(view)
|
|
|
+ controller.navigate(
|
|
|
+ R.id.action_inputFragment_to_selectedItemFragment,
|
|
|
+ bundle
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|