|
@@ -8,14 +8,17 @@ import android.view.View
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
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.show
|
|
|
import com.yingyangfly.baselib.ext.toast
|
|
import com.yingyangfly.baselib.ext.toast
|
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
import com.yingyangfly.baselib.utils.JumpUtil
|
|
import com.yingyangfly.baselib.utils.JumpUtil
|
|
|
import com.yingyangfly.evaluation.R
|
|
import com.yingyangfly.evaluation.R
|
|
|
import com.yingyangfly.evaluation.adapter.EvaluationHistoryAdapter
|
|
import com.yingyangfly.evaluation.adapter.EvaluationHistoryAdapter
|
|
|
|
|
+import com.yingyangfly.evaluation.adapter.OtherEvaluationHistoryAdapter
|
|
|
import com.yingyangfly.evaluation.databinding.ActivityEvaluationHistoryBinding
|
|
import com.yingyangfly.evaluation.databinding.ActivityEvaluationHistoryBinding
|
|
|
import com.yingyangfly.evaluation.entity.EvaluationHistoryBean
|
|
import com.yingyangfly.evaluation.entity.EvaluationHistoryBean
|
|
|
|
|
+import com.yingyangfly.evaluation.entity.SelectAnswerRecord
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -26,11 +29,29 @@ class EvaluationHistoryActivity :
|
|
|
BaseMVVMActivity<ActivityEvaluationHistoryBinding, EvaluationHistoryViewModel>(),
|
|
BaseMVVMActivity<ActivityEvaluationHistoryBinding, EvaluationHistoryViewModel>(),
|
|
|
View.OnTouchListener {
|
|
View.OnTouchListener {
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 其他测评
|
|
|
|
|
+ */
|
|
|
|
|
+ private var page = 1
|
|
|
|
|
+ private val otherEvaluationHistoryAdapter by lazy { OtherEvaluationHistoryAdapter() }
|
|
|
|
|
+ private var selectAnswerRecord = mutableListOf<SelectAnswerRecord>()
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * MOCA/MMSE测评
|
|
|
|
|
+ */
|
|
|
private var results = mutableListOf<EvaluationHistoryBean>()
|
|
private var results = mutableListOf<EvaluationHistoryBean>()
|
|
|
private val adapter by lazy { EvaluationHistoryAdapter() }
|
|
private val adapter by lazy { EvaluationHistoryAdapter() }
|
|
|
|
|
|
|
|
override fun initViews() {
|
|
override fun initViews() {
|
|
|
binding {
|
|
binding {
|
|
|
|
|
+ swipeOtherResult.setEnableLoadMore(true)
|
|
|
|
|
+ swipeOtherResult.setEnableRefresh(true)
|
|
|
|
|
+ rvOtherResult.adapter = otherEvaluationHistoryAdapter
|
|
|
|
|
+ otherEvaluationHistoryAdapter.setData(selectAnswerRecord)
|
|
|
|
|
+ otherEvaluationHistoryAdapter.onClickListener = {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
rvResult.adapter = adapter
|
|
rvResult.adapter = adapter
|
|
|
adapter.setData(results)
|
|
adapter.setData(results)
|
|
|
adapter.onClickListener = {
|
|
adapter.onClickListener = {
|
|
@@ -51,11 +72,21 @@ class EvaluationHistoryActivity :
|
|
|
layoutHead.setOnTouchListener(this@EvaluationHistoryActivity)
|
|
layoutHead.setOnTouchListener(this@EvaluationHistoryActivity)
|
|
|
radioEvaluation.setOnCheckedChangeListener { group, checkedId ->
|
|
radioEvaluation.setOnCheckedChangeListener { group, checkedId ->
|
|
|
if (checkedId == R.id.radioProfessionalEvaluation) {
|
|
if (checkedId == R.id.radioProfessionalEvaluation) {
|
|
|
|
|
+ showEvaluationsView(false)
|
|
|
getReviewTaskHistoryList()
|
|
getReviewTaskHistoryList()
|
|
|
} else if (checkedId == R.id.radioOtherEvaluation) {
|
|
} else if (checkedId == R.id.radioOtherEvaluation) {
|
|
|
- getOtherReviewTaskHistory()
|
|
|
|
|
|
|
+ showEvaluationsView(true)
|
|
|
|
|
+ getOtherReviewTaskHistory(true, true)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ swipeOtherResult.setOnRefreshListener {
|
|
|
|
|
+ getOtherReviewTaskHistory(true, false)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ swipeOtherResult.setOnLoadMoreListener {
|
|
|
|
|
+ getOtherReviewTaskHistory(false, false)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -68,16 +99,36 @@ class EvaluationHistoryActivity :
|
|
|
getReviewTaskHistoryList()
|
|
getReviewTaskHistoryList()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private fun getOtherReviewTaskHistory() {
|
|
|
|
|
- Log.e("wpp", "获取其他测评历史记录")
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取其他测评历史记录
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun getOtherReviewTaskHistory(isRefresh: Boolean, isShowLoading: Boolean) {
|
|
|
|
|
+ if (isRefresh) {
|
|
|
|
|
+ page = 1
|
|
|
|
|
+ binding.swipeOtherResult.resetNoMoreData()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ page++
|
|
|
|
|
+ }
|
|
|
|
|
+ viewModel.getSelectAnswerRecord(page, isShowLoading, fail = {
|
|
|
|
|
+ endRefresh()
|
|
|
|
|
+ it.toast()
|
|
|
|
|
+ }, success = {
|
|
|
|
|
+ endRefresh()
|
|
|
|
|
+ if (isRefresh) {
|
|
|
|
|
+ selectAnswerRecord.clear()
|
|
|
|
|
+ }
|
|
|
|
|
+ if (it != null && it.records.isNullOrEmpty().not()) {
|
|
|
|
|
+ selectAnswerRecord.addAll(it.records)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ binding.swipeOtherResult.finishLoadMoreWithNoMoreData()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 加载数据
|
|
* 加载数据
|
|
|
*/
|
|
*/
|
|
|
private fun getReviewTaskHistoryList() {
|
|
private fun getReviewTaskHistoryList() {
|
|
|
- Log.e("wpp", "获取专业测评历史记录")
|
|
|
|
|
results.clear()
|
|
results.clear()
|
|
|
viewModel.getReviewTaskHistoryList(fail = {
|
|
viewModel.getReviewTaskHistoryList(fail = {
|
|
|
it.toast()
|
|
it.toast()
|
|
@@ -118,4 +169,26 @@ class EvaluationHistoryActivity :
|
|
|
}
|
|
}
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 页面展示逻辑
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun showEvaluationsView(isOtherEvaluations: Boolean) {
|
|
|
|
|
+ binding {
|
|
|
|
|
+ tvTitleTag.show(isOtherEvaluations.not())
|
|
|
|
|
+ resultLayout.show(isOtherEvaluations.not())
|
|
|
|
|
+ tvOtherTitleTag.show(isOtherEvaluations)
|
|
|
|
|
+ otherResultLayout.show(isOtherEvaluations)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 结束刷新
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun endRefresh() {
|
|
|
|
|
+ binding {
|
|
|
|
|
+ swipeOtherResult.finishRefresh()
|
|
|
|
|
+ swipeOtherResult.finishLoadMore()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|