lmw
2023-06-25 a988e7c15f5ce63785b77e01c89bec2565668982
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.kuanzhai.driver.ui.adapter
 
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import cn.sinata.xldutils.utils.clickDelay
import com.kuanzhai.driver.R
import com.kuanzhai.driver.base.BaseRvAdapter
import com.kuanzhai.driver.base.BaseViewHolder
import com.kuanzhai.driver.bean.MerchantCouponData
import com.kuanzhai.driver.utils.glide.GlideUtil
import kotlinx.android.synthetic.main.item_conpon_merchant_mine.view.*
 
class ConponMerchantMineAdapter: BaseRvAdapter<MutableList<MerchantCouponData>>() {
 
    var type = 1 //1=正常,2=失效
 
    override fun getLayoutResId(viewType: Int): Int {
        return R.layout.item_conpon_merchant_mine
    }
 
    override fun onBindItem(holder: BaseViewHolder?, view: View?, item: MutableList<MerchantCouponData>?) {
        holder?.let {
            it.itemView.recycler_view_item.layoutManager = LinearLayoutManager(context)
            var itemAdapter = ConponMerchantitemAdapter()
            itemAdapter.type = type
            itemAdapter.data.addAll(item!!)
            it.itemView.recycler_view_item.adapter = itemAdapter
 
            it.itemView.ll_bottom.clickDelay {
                itemAdapter.isAll =  !itemAdapter.isAll
                itemAdapter.notifyDataSetChanged()
            }
            var hint = it.itemView.tv_hint_more
            it.itemView.ll_bottom.visibility = if (item.size > 2) View.VISIBLE else View.GONE
            hint.text = if (itemAdapter.isAll) "收起" else "展开"
            GlideUtil.loady(context, item!![0].headImg,it.itemView.iv_head)
            it.itemView.tv_name.text = item[0].merchantName
            it.itemView.ll_bottom.clickDelay {
                itemAdapter.isAll = !itemAdapter.isAll
                itemAdapter.notifyDataSetChanged()
                hint.text = if (it.itemView.tv_hint_more.text.toString() == "展开") "收起" else "展开"
            }
 
        }
    }
 
}