package com.yidian.shenghuoquan.border.adapter

import android.graphics.Rect
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.yidian.shenghuoquan.border.R
import com.yidian.shenghuoquan.border.databinding.BorderItemPickupPointListBinding
import com.yidian.shenghuoquan.border.viewmodel.PickupPointListItemViewModel
import com.yidian.utils.DensityUtil

/**
 * author: yinjiacheng
 * date: 2021/8/24 16:57
 * description: 自提点列表
 */
class PickupPointListAdapter : RecyclerView.Adapter<PickupPointListAdapter.PickupPointListViewHolder>() {

  override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PickupPointListViewHolder {
    val binding = DataBindingUtil.inflate<BorderItemPickupPointListBinding>(
      LayoutInflater.from(parent.context),
      R.layout.border_item_pickup_point_list,
      parent,
      false
    )
    return PickupPointListViewHolder(binding.root, binding)
  }

  override fun onBindViewHolder(holder: PickupPointListViewHolder, position: Int) {
    holder.binding.vm = PickupPointListItemViewModel()
  }

  override fun getItemCount(): Int {
    return 0
  }

  class PickupPointListViewHolder(itemView: View, val binding: BorderItemPickupPointListBinding) : RecyclerView.ViewHolder(itemView)

  class PickupPointListItemDecoration : RecyclerView.ItemDecoration() {
    override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
      outRect.top = DensityUtil.dp2px(28F)
    }
  }

}

