package com.adealink.weparty.commonui.recycleview.commonviewholder

import android.view.LayoutInflater
import android.view.ViewGroup
import com.adealink.weparty.commonui.recycleview.adapter.BindingViewHolder
import com.adealink.weparty.commonui.recycleview.adapter.multitype.ItemViewBinder
import com.adealink.weparty.databinding.ItemCommonSpaceBinding

class CommonSpaceItemViewBinder: ItemViewBinder<CommonSpaceItemData, BindingViewHolder<ItemCommonSpaceBinding>>() {
    override fun onBindViewHolder(
        holder: BindingViewHolder<ItemCommonSpaceBinding>,
        item: CommonSpaceItemData
    ) {
        val lp = holder.binding.root.layoutParams
        lp.height = item.footerHeight
        holder.binding.root.layoutParams = lp
    }

    override fun onCreateViewHolder(
        inflater: LayoutInflater,
        parent: ViewGroup
    ): BindingViewHolder<ItemCommonSpaceBinding> {
        return BindingViewHolder(ItemCommonSpaceBinding.inflate(inflater, parent, false))
    }
}