|
@@ -37,7 +37,7 @@ class CountFragment : BaseFragment<FragmentCountBinding>(), View.OnTouchListener
|
|
|
private var fourthQuestion: QuestionsBean? = null
|
|
|
private var fifthQuestion: QuestionsBean? = null
|
|
|
|
|
|
- private var questionOne = false
|
|
|
+ private var questionOne = true
|
|
|
private var questionTwo = false
|
|
|
private var questionThree = false
|
|
|
private var questionFour = false
|
|
@@ -91,6 +91,7 @@ class CountFragment : BaseFragment<FragmentCountBinding>(), View.OnTouchListener
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
override fun initListener() {
|
|
|
+ setOnFocusChangeListener()
|
|
|
binding {
|
|
|
btnPrevious.setOnTouchListener(this@CountFragment)
|
|
|
btnNext.setOnTouchListener(this@CountFragment)
|
|
@@ -101,6 +102,53 @@ class CountFragment : BaseFragment<FragmentCountBinding>(), View.OnTouchListener
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 监听光标
|
|
|
+ */
|
|
|
+ private fun setOnFocusChangeListener() {
|
|
|
+ binding {
|
|
|
+ editResultOne.setOnFocusChangeListener { v, hasFocus ->
|
|
|
+ questionOne = hasFocus
|
|
|
+ questionTwo = false
|
|
|
+ questionThree = false
|
|
|
+ questionFour = false
|
|
|
+ questionFive = false
|
|
|
+ }
|
|
|
+
|
|
|
+ editResultTwo.setOnFocusChangeListener { v, hasFocus ->
|
|
|
+ questionOne = false
|
|
|
+ questionTwo = hasFocus
|
|
|
+ questionThree = false
|
|
|
+ questionFour = false
|
|
|
+ questionFive = false
|
|
|
+ }
|
|
|
+
|
|
|
+ editResultThree.setOnFocusChangeListener { v, hasFocus ->
|
|
|
+ questionOne = false
|
|
|
+ questionTwo = false
|
|
|
+ questionThree = hasFocus
|
|
|
+ questionFour = false
|
|
|
+ questionFive = false
|
|
|
+ }
|
|
|
+
|
|
|
+ editResultFour.setOnFocusChangeListener { v, hasFocus ->
|
|
|
+ questionOne = false
|
|
|
+ questionTwo = false
|
|
|
+ questionThree = false
|
|
|
+ questionFour = hasFocus
|
|
|
+ questionFive = false
|
|
|
+ }
|
|
|
+
|
|
|
+ editResultFive.setOnFocusChangeListener { v, hasFocus ->
|
|
|
+ questionOne = false
|
|
|
+ questionTwo = false
|
|
|
+ questionThree = false
|
|
|
+ questionFour = false
|
|
|
+ questionFive = hasFocus
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
loadData()
|
|
@@ -386,6 +434,8 @@ class CountFragment : BaseFragment<FragmentCountBinding>(), View.OnTouchListener
|
|
|
private fun save() {
|
|
|
if (dao != null) {
|
|
|
if (questionOne) {
|
|
|
+ questionOne = false
|
|
|
+ questionTwo = true
|
|
|
if (firstQuestion != null) {
|
|
|
firstQuestion!!.inputString = binding.editResultOne.toString().trim()
|
|
|
firstQuestion!!.reviewId = firstQuestion!!.id
|
|
@@ -395,6 +445,8 @@ class CountFragment : BaseFragment<FragmentCountBinding>(), View.OnTouchListener
|
|
|
}
|
|
|
}
|
|
|
if (questionTwo) {
|
|
|
+ questionTwo = false
|
|
|
+ questionThree = true
|
|
|
if (secondQuestion != null) {
|
|
|
secondQuestion!!.inputString = binding.editResultTwo.toString().trim()
|
|
|
secondQuestion!!.reviewId = secondQuestion!!.id
|
|
@@ -404,6 +456,8 @@ class CountFragment : BaseFragment<FragmentCountBinding>(), View.OnTouchListener
|
|
|
}
|
|
|
}
|
|
|
if (questionThree) {
|
|
|
+ questionThree = false
|
|
|
+ questionFour = true
|
|
|
if (thirdQuestion != null) {
|
|
|
thirdQuestion!!.inputString = binding.editResultThree.toString().trim()
|
|
|
thirdQuestion!!.reviewId = thirdQuestion!!.id
|
|
@@ -413,6 +467,8 @@ class CountFragment : BaseFragment<FragmentCountBinding>(), View.OnTouchListener
|
|
|
}
|
|
|
}
|
|
|
if (questionFour) {
|
|
|
+ questionFour = false
|
|
|
+ questionFive = true
|
|
|
if (fourthQuestion != null) {
|
|
|
fourthQuestion!!.inputString = binding.editResultFour.toString().trim()
|
|
|
fourthQuestion!!.reviewId = fourthQuestion!!.id
|