package com.ytpm.hydtw.adapter

import android.content.Context
import android.content.Intent
import com.ytpm.hydtw.activity.ZizunInfoActivity
import com.ytpm.hydtw.dao.IdiomStory
import com.ytpm.hydtw.databinding.AdapterZixunBinding
import com.ytpm.hydtw.utils.GlideUtils

class ZixunAdapter(items: MutableList<IdiomStory>) :
    BaseAdapter<AdapterZixunBinding, IdiomStory>(AdapterZixunBinding::inflate, items) {
    override fun onBindingData(
        context: Context,
        holder: BaseHolder<AdapterZixunBinding>,
        binding: AdapterZixunBinding,
        t: IdiomStory,
        position: Int
    ) {
        val img =
            "https://qcloud.dpfile.com/pc/0KllxlOXvt4BaoFnx7kC2_JlBzHTkOz8DMFGfnT6l88SGGlMSSgiAwikSXh28Nhx.jpg"
        GlideUtils().roundImages(context, img, binding.chim, 20)

        binding.title.text = t.title
        binding.content.text = t.content

        binding.root.setOnClickListener {
            val intent = Intent(context, ZizunInfoActivity::class.java)
            intent.putExtra("title", t.title)
            intent.putExtra("content", t.content)
            context.startActivity(intent)
        }
    }
}