package com.adealink.weparty.profile.ui.about.adapter

import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.ViewGroup
import com.adealink.weparty.commonui.ext.dp
import com.adealink.weparty.commonui.recycleview.adapter.BindingViewHolder
import com.adealink.weparty.commonui.recycleview.adapter.multitype.ItemViewBinder
import com.adealink.weparty.profile.databinding.LayoutProfileDynamicTitleBinding
import com.adealink.weparty.profile.ui.about.data.DynamicTitleItemData


class DynamicTitleViewBinder() :
    ItemViewBinder<DynamicTitleItemData, BindingViewHolder<LayoutProfileDynamicTitleBinding>>() {

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

    @SuppressLint("SetTextI18n")
    override fun onBindViewHolder(
        holder: BindingViewHolder<LayoutProfileDynamicTitleBinding>,
        item: DynamicTitleItemData
    ) {
        if (holder.layoutPosition == 0) {
            holder.binding.root.setPadding(0, 16.dp(), 0, 0)
        } else {
            holder.binding.root.setPadding(0, 28.dp(), 0, 0)
        }
    }

}