package com.dahe.gldriver.ui.mine.fragment

import android.graphics.Color
import android.os.Bundle
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import com.dahe.gldriver.R
import com.dahe.gldriver.adapter.CarsAdapter
import com.dahe.gldriver.adapter.DriversAdapter
import com.dahe.gldriver.adapter.WaybillAdapter
import com.dahe.gldriver.databinding.ActivityCarsManBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.glex.bean.WayBillBean
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ConvertUtils

/**
 * @ClassName CarsManActivity
 * @Author john
 * @Date 2024/2/1 08:59
 * @Description 车辆管理
 */
class DriversManFragment : BaseFragment<FragmentWaybillListBinding>() {

    override fun onFragmentVisibleChange(isVisible: Boolean) {
    }

    override fun onFragmentFirstVisible() {
        var datas = mutableListOf<WayBillBean>(
            WayBillBean(),
            WayBillBean(),
            WayBillBean(),
            WayBillBean(),
            WayBillBean(),
            WayBillBean(),
            WayBillBean(),
            WayBillBean()
        )

        var adapter = binding.recyclerView.run {
            layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
            addItemDecoration(
                RecycleViewDivider(
                    LinearLayout.VERTICAL,
                    ConvertUtils.dp2px(16.0f),
                    Color.TRANSPARENT
                )
            )
            adapter = DriversAdapter()
            adapter as DriversAdapter
        }

        adapter.submitList(datas)
    }
}