package com.zj365.health.adapter
import android.view.View
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.zj365.health.R
import com.xty.network.model.ValueMap

/**
 * 数据对比
 */
class CompareAdapter : BaseAdapter<ValueMap>(R.layout.item_xl_compare_data) {

    val imageIds by lazy {
        arrayOf(
            R.mipmap.xiangt,
            R.mipmap.shangsheng,
            R.mipmap.xiajiang,
                    R.mipmap.xiangt
        )
    }
    override fun convert(holder: BaseViewHolder, item: ValueMap) {
        holder.setText(R.id.index,  item.title )
        holder.setText(R.id.text1,  item.valueCompare  )
        holder.setText(R.id.text2,   item.value   )
        holder.setImageResource(R.id.image, imageIds[item.state])
        if (getItemPosition(item)==0){
            holder.getView<View>(R.id.image).visibility = View.INVISIBLE
        }
    }
}