package com.yidian.shenghuoquan.border.ui

import androidx.activity.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.yidian.bcommon.constant.XRouterPathConstants
import com.yidian.bcommon.mvvm.BaseMvvmActivity
import com.yidian.shenghuoquan.border.R
import com.yidian.shenghuoquan.border.adapter.PickupPointListAdapter
import com.yidian.shenghuoquan.border.databinding.BorderActivitySelectPickupPointBinding
import com.yidian.shenghuoquan.border.viewmodel.SelectPickupPointViewModel
import com.yidian.xpage.XPageViewProtocol

/**
 * author: yinjiacheng
 * date: 2021/8/24 14:02
 * description: 选择自提点页
 */
class SelectPickupPointActivity : BaseMvvmActivity<BorderActivitySelectPickupPointBinding, SelectPickupPointViewModel>(),
  XPageViewProtocol {

  override val layoutId = R.layout.border_activity_select_pickup_point
  override val vm: SelectPickupPointViewModel by viewModels()
  private val adapter by lazy { PickupPointListAdapter() }

  override fun getXPageName(): String {
    return XRouterPathConstants.PICKUP_POINT_ACTIVITY
  }

  override fun initView() {
    initRecyclerView()
  }

  private fun initRecyclerView() {
    binding.rvPickupPointList.adapter = adapter
    binding.rvPickupPointList.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
    binding.rvPickupPointList.addItemDecoration(PickupPointListAdapter.PickupPointListItemDecoration())
  }
}
