package cn.muchinfo.rma.view.base.future.costs

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import cn.muchinfo.rma.R
import cn.muchinfo.rma.view.base.BaseFragment
import cn.muchinfo.rma.view.base.future.deals.DealData

/**
 * 资金信息
 */
class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
    private var type: String? = type

    companion object {
        fun getInstance(type: String?) = CostInfoFragment(type)
    }

    private var _view: View? = null
    private var idCostInfoList: RecyclerView? = null

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        _view = inflater.inflate(R.layout.cost_info, container, false)
        initViews()
        return _view
    }

    private fun initViews() {
        idCostInfoList = _view?.findViewById(R.id.id_cost_info_list)

        val layoutManager = LinearLayoutManager(context)
        idCostInfoList?.layoutManager = layoutManager
        viewModel.makeCostInfo()
        idCostInfoList?.adapter = viewModel.getCostInfoAdapter()
    }
}