|
|
@@ -1,10 +1,12 @@
|
|
|
package com.yingyangfly.evaluation.adapter
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
+import android.text.TextUtils
|
|
|
import com.yingyangfly.baselib.adapter.BaseDataBindingAdapter
|
|
|
import com.yingyangfly.baselib.ext.setOnSingleClickListener
|
|
|
import com.yingyangfly.evaluation.R
|
|
|
import com.yingyangfly.evaluation.databinding.ItemOtherEvaluationHistoryBinding
|
|
|
+import com.yingyangfly.evaluation.entity.EvaluationTypeBean
|
|
|
import com.yingyangfly.evaluation.entity.SelectAnswerRecord
|
|
|
|
|
|
/**
|
|
|
@@ -15,11 +17,33 @@ class OtherEvaluationHistoryAdapter(override val layoutId: Int = R.layout.item_o
|
|
|
|
|
|
var onClickListener: ((bean: SelectAnswerRecord) -> Unit)? = null
|
|
|
|
|
|
+
|
|
|
+ private var evaluationTypeList = mutableListOf<EvaluationTypeBean>()
|
|
|
+
|
|
|
+ @SuppressLint("NotifyDataSetChanged")
|
|
|
+ fun setEvaluationType(list: List<EvaluationTypeBean>) {
|
|
|
+ evaluationTypeList.clear()
|
|
|
+ if (list.isNullOrEmpty().not()) {
|
|
|
+ evaluationTypeList.addAll(list)
|
|
|
+ }
|
|
|
+ notifyDataSetChanged()
|
|
|
+ }
|
|
|
+
|
|
|
@SuppressLint("SetTextI18n")
|
|
|
override fun onBindViewHolder(
|
|
|
binding: ItemOtherEvaluationHistoryBinding, item: SelectAnswerRecord, position: Int
|
|
|
) {
|
|
|
binding.data = item
|
|
|
+ var questionType = ""
|
|
|
+ if (evaluationTypeList.isNullOrEmpty().not()) {
|
|
|
+ evaluationTypeList.forEach {
|
|
|
+ if (TextUtils.equals(it.dictValue, item.questionType)) {
|
|
|
+ questionType = it.dictLabel
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ binding.tvQuestionType.text = questionType
|
|
|
+
|
|
|
if (position % 2 == 0) {
|
|
|
binding.evaluationLayout.setBackgroundResource(R.drawable.bg_other_evaluation_result)
|
|
|
} else {
|