package com.ym.chat.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.tencent.qcloud.tuicore.util.DateTimeUtil
import com.ym.chat.R
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.model.chat.MsgList
import java.util.*

class SystemMsgAdapter : BaseRecyclerAdapter<MsgList, SystemMsgAdapter.ViewHolder> {
    private var mContext: Context? = null

    constructor(
        content: Context?
    ) : super() {
        mContext = content
    }

    override fun onCreateViewHolder(holder: ViewGroup, p1: Int): ViewHolder {
        return ViewHolder(
            LayoutInflater.from(holder.context)
                .inflate(R.layout.item_layout_system_msg, holder, false)
        )
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val data = mList[position]
        holder.id_tv_system_msg_time.text =
            DateTimeUtil.getTimeFormatText(Date((data.MsgTimeStamp!! * 1000)))
        holder.id_tv_systm_msg_content.text = data.MsgBody!![0].MsgContent?.Text

    }

    inner class ViewHolder : RecyclerView.ViewHolder {


        var id_tv_system_msg_time: TextView
        var id_tv_systm_msg_content: TextView

        constructor(itemView: View) : super(itemView) {
            id_tv_system_msg_time = itemView.findViewById(R.id.id_tv_system_msg_time)
            id_tv_systm_msg_content = itemView.findViewById(R.id.id_tv_systm_msg_content)

        }
    }

}