|
|
@@ -1,5 +1,6 @@
|
|
|
package com.yingyangfly.moca.numberrecords
|
|
|
|
|
|
+import android.os.Bundle
|
|
|
import androidx.core.os.bundleOf
|
|
|
import androidx.navigation.Navigation
|
|
|
import androidx.recyclerview.widget.GridLayoutManager
|
|
|
@@ -8,6 +9,7 @@ import com.yingyang.moca.databinding.FragmentNumberRecordsBinding
|
|
|
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.moca.adapter.NumberAdapter
|
|
|
|
|
|
/**
|
|
|
@@ -15,11 +17,21 @@ import com.yingyangfly.moca.adapter.NumberAdapter
|
|
|
*/
|
|
|
class NumberRecordsFragment : BaseFragment<FragmentNumberRecordsBinding>() {
|
|
|
|
|
|
+ /**
|
|
|
+ * 问题id
|
|
|
+ */
|
|
|
+ private var questionId = 0
|
|
|
+
|
|
|
private val numberList = mutableListOf<String>()
|
|
|
private val numberAdapter by lazy { NumberAdapter() }
|
|
|
private val stringBuffer = StringBuffer()
|
|
|
var question: QuestionsBean? = null
|
|
|
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+ questionId = arguments?.getInt("questionId") ?: 57
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
+ }
|
|
|
+
|
|
|
override fun initViews() {
|
|
|
binding.rvNum.layoutManager = GridLayoutManager(mContext, 3)
|
|
|
binding.rvNum.adapter = numberAdapter
|
|
|
@@ -61,20 +73,33 @@ class NumberRecordsFragment : BaseFragment<FragmentNumberRecordsBinding>() {
|
|
|
override fun initListener() {
|
|
|
binding {
|
|
|
btnPrevious.setOnSingleClickListener {
|
|
|
- val controller = Navigation.findNavController(it)
|
|
|
- val bundle = bundleOf("questionId" to 51)
|
|
|
- controller.navigate(
|
|
|
- R.id.action_numberRecordsFragment_to_memorizeNumbersFragment,
|
|
|
- bundle
|
|
|
- )
|
|
|
+ if (questionId == 59) {
|
|
|
+ val controller = Navigation.findNavController(it)
|
|
|
+ val bundle = bundleOf("questionId" to questionId)
|
|
|
+ controller.navigate(
|
|
|
+ R.id.action_numberRecordsFragment_to_timepieceFragment,
|
|
|
+ bundle
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ val controller = Navigation.findNavController(it)
|
|
|
+ val bundle = bundleOf("questionId" to 51)
|
|
|
+ controller.navigate(
|
|
|
+ R.id.action_numberRecordsFragment_to_memorizeNumbersFragment,
|
|
|
+ bundle
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
btnNext.setOnSingleClickListener {
|
|
|
- val controller = Navigation.findNavController(it)
|
|
|
- val bundle = bundleOf("questionId" to 52)
|
|
|
- controller.navigate(
|
|
|
- R.id.action_numberRecordsFragment_to_computationFragment,
|
|
|
- bundle
|
|
|
- )
|
|
|
+ if (questionId == 59) {
|
|
|
+ "计时器".toast()
|
|
|
+ } else {
|
|
|
+ val controller = Navigation.findNavController(it)
|
|
|
+ val bundle = bundleOf("questionId" to 52)
|
|
|
+ controller.navigate(
|
|
|
+ R.id.action_numberRecordsFragment_to_computationFragment,
|
|
|
+ bundle
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|