|
@@ -95,17 +95,16 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
|
|
|
private fun loadData() {
|
|
|
if (dao != null) {
|
|
|
firstquestion = dao?.getQuestion(questionId)
|
|
|
- Log.e("wpp", "firstquestion-----------------" + firstquestion?.inputString)
|
|
|
if (firstquestion != null) {
|
|
|
- binding.tvResultOne.text = if (firstquestion?.inputString.isNullOrEmpty()) {
|
|
|
+ val str = if (firstquestion?.inputString.isNullOrEmpty()) {
|
|
|
""
|
|
|
} else {
|
|
|
firstquestion?.inputString
|
|
|
}
|
|
|
+ binding.editResultOne.setText(str)
|
|
|
}
|
|
|
val secondQuestionnId = questionId + 1
|
|
|
secondQuestion = dao?.getQuestion(secondQuestionnId)
|
|
|
- Log.e("wpp", "secondQuestion-----------------" + secondQuestion?.inputString)
|
|
|
if (secondQuestion != null) {
|
|
|
binding.tvResultTwo.text = if (secondQuestion?.inputString.isNullOrEmpty()) {
|
|
|
""
|
|
@@ -115,7 +114,6 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
|
|
|
}
|
|
|
val thirdQuestionId = questionId + 2
|
|
|
thirdQuestion = dao?.getQuestion(thirdQuestionId)
|
|
|
- Log.e("wpp", "thirdQuestion-----------------" + thirdQuestion?.inputString)
|
|
|
if (thirdQuestion != null) {
|
|
|
binding.tvResultThree.text = if (thirdQuestion?.inputString.isNullOrEmpty()) {
|
|
|
""
|
|
@@ -125,7 +123,6 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
|
|
|
}
|
|
|
val fourthQuestionId = questionId + 3
|
|
|
fourthQuestion = dao?.getQuestion(fourthQuestionId)
|
|
|
- Log.e("wpp", "fourthQuestion-----------------" + fourthQuestion?.inputString)
|
|
|
if (fourthQuestion != null) {
|
|
|
binding.tvResultFour.text = if (fourthQuestion?.inputString.isNullOrEmpty()) {
|
|
|
""
|
|
@@ -135,7 +132,6 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
|
|
|
}
|
|
|
val fifthQuestionId = questionId + 4
|
|
|
fifthQuestion = dao?.getQuestion(fifthQuestionId)
|
|
|
- Log.e("wpp", "fifthQuestion-----------------" + fifthQuestion?.inputString)
|
|
|
if (fifthQuestion != null) {
|
|
|
binding.tvResultFive.text = if (fifthQuestion?.inputString.isNullOrEmpty()) {
|
|
|
""
|
|
@@ -151,12 +147,12 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
|
|
|
*/
|
|
|
private fun judge(): Boolean {
|
|
|
if (dao != null) {
|
|
|
- if (binding.tvResultOne.text.toString().isNullOrEmpty()) {
|
|
|
+ if (binding.editResultOne.text.toString().trim().isNullOrEmpty()) {
|
|
|
"请输入第一道题目的答案".toast()
|
|
|
return false
|
|
|
} else {
|
|
|
if (firstquestion != null) {
|
|
|
- firstquestion?.inputString = binding.tvResultOne.text.toString()
|
|
|
+ firstquestion?.inputString = binding.editResultOne.text.toString()
|
|
|
dao?.update(firstquestion!!)
|
|
|
}
|
|
|
}
|