|
@@ -2,6 +2,7 @@ package com.yingyangfly.ncse.fragment
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
import android.annotation.SuppressLint
|
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
|
|
|
+import android.text.TextUtils
|
|
|
import android.view.MotionEvent
|
|
import android.view.MotionEvent
|
|
|
import android.view.View
|
|
import android.view.View
|
|
|
import androidx.core.os.bundleOf
|
|
import androidx.core.os.bundleOf
|
|
@@ -10,6 +11,7 @@ import com.yingyangfly.baselib.base.BaseFragment
|
|
|
import com.yingyangfly.baselib.db.QuestionsBean
|
|
import com.yingyangfly.baselib.db.QuestionsBean
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
|
|
+import com.yingyangfly.baselib.ext.toast
|
|
|
import com.yingyangfly.ncse.R
|
|
import com.yingyangfly.ncse.R
|
|
|
import com.yingyangfly.ncse.databinding.FragmentLookPictureBinding
|
|
import com.yingyangfly.ncse.databinding.FragmentLookPictureBinding
|
|
|
|
|
|
|
@@ -32,6 +34,7 @@ class LookPictureFragment : BaseFragment<FragmentLookPictureBinding>(),View.OnTo
|
|
|
binding {
|
|
binding {
|
|
|
btnPrevious.setOnTouchListener(this@LookPictureFragment)
|
|
btnPrevious.setOnTouchListener(this@LookPictureFragment)
|
|
|
btnNext.setOnTouchListener(this@LookPictureFragment)
|
|
btnNext.setOnTouchListener(this@LookPictureFragment)
|
|
|
|
|
+ tvNotarize.setOnTouchListener(this@LookPictureFragment)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -48,12 +51,22 @@ class LookPictureFragment : BaseFragment<FragmentLookPictureBinding>(),View.OnTo
|
|
|
}
|
|
}
|
|
|
MotionEvent.ACTION_UP -> {
|
|
MotionEvent.ACTION_UP -> {
|
|
|
v.startAnimation(getEndAnimation())
|
|
v.startAnimation(getEndAnimation())
|
|
|
- if (v.id == R.id.btnPrevious) {
|
|
|
|
|
|
|
+ if (v.id == R.id.tvNotarize){
|
|
|
|
|
+ saveData(v)
|
|
|
|
|
+ } else if (v.id == R.id.btnPrevious) {
|
|
|
pageUp(v)
|
|
pageUp(v)
|
|
|
} else if (v.id == R.id.btnNext) {
|
|
} else if (v.id == R.id.btnNext) {
|
|
|
-
|
|
|
|
|
|
|
+ if (TextUtils.isEmpty(question!!.inputString)){
|
|
|
|
|
+ if (binding.tvDescribe.text.toString().isEmpty()){
|
|
|
|
|
+ val str = "请记录患者的回应!"
|
|
|
|
|
+ str.toast()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ saveData(v)
|
|
|
|
|
+ pageNext(v)
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
pageNext(v)
|
|
pageNext(v)
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
@@ -65,6 +78,43 @@ class LookPictureFragment : BaseFragment<FragmentLookPictureBinding>(),View.OnTo
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ override fun onResume() {
|
|
|
|
|
+ super.onResume()
|
|
|
|
|
+ loadData()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 加载数据
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun loadData() {
|
|
|
|
|
+ binding.tvDescribe.setText("")
|
|
|
|
|
+ if (questionsDao != null) {
|
|
|
|
|
+ question = questionsDao?.getQuestion(questionId)
|
|
|
|
|
+ if (question != null) {
|
|
|
|
|
+ binding.data = question
|
|
|
|
|
+ if (question!!.inputString.isNullOrEmpty().not()) {
|
|
|
|
|
+ binding.tvDescribe.post {
|
|
|
|
|
+ binding.tvDescribe.setText(question!!.inputString)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 确认保存
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun saveData(v: View){
|
|
|
|
|
+ if (question != null){
|
|
|
|
|
+ question!!.inputString = binding.tvDescribe.text.toString().trim()
|
|
|
|
|
+ question!!.reviewId = question!!.id
|
|
|
|
|
+ question!!.reviewAnswer = binding.tvDescribe.text.toString().trim()
|
|
|
|
|
+ question!!.correct = ""
|
|
|
|
|
+ questionsDao?.update(question!!)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 上一页
|
|
* 上一页
|
|
|
*/
|
|
*/
|