package com.dahe.gldriver.ui.message

import android.content.Context
import android.graphics.Color
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.dahe.gldriver.R
import com.dahe.gldriver.adapter.MessageAdapter
import com.dahe.gldriver.databinding.FragmentMessageBinding
import com.dahe.gldriver.databinding.FragmentWaybillBinding
import com.dahe.glex.bean.WayBillBean
import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.callback.RefreshCallBack
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ConvertUtils
import net.lucode.hackware.magicindicator.ViewPagerHelper
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView


/**
 * @ClassName HomeFragment
 * @Author 用户
 * @Date 2023/9/21 10:13
 * @Description TODO
 */
class MessageFragment : BaseFragment<FragmentMessageBinding>(), RefreshCallBack {


    override fun onFragmentVisibleChange(isVisible: Boolean) {
        if (isVisible) {
        }

    }

    override fun onFragmentFirstVisible() {
        initRecy()

    }


    override fun getRefreshDate(stat: Int, page: Int, count: Int) {

    }

    private fun initRecy() {
        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
                )
            )
            setHasFixedSize(true)
            adapter = MessageAdapter()
            adapter as MessageAdapter
        }

        adapter.addData(datas)
    }

}