package com.lukouguoji.gjj.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.ActivityGjjManifestBinding
import com.lukouguoji.gjj.databinding.ActivityGjjTallyListBinding
import com.lukouguoji.gjj.holder.GjjManifestListViewHolder
import com.lukouguoji.gjj.holder.GjjTallyListViewHolder
import com.lukouguoji.gjj.viewModel.GjjManifestListViewModel
import com.lukouguoji.gjj.viewModel.GjjTallyViewModel
import com.lukouguoji.module_base.BaseActivity
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.base.CommonAdapter
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.router.ARouterConstants
import kotlin.properties.Delegates

@Route(path = ARouterConstants.ACTIVITY_URL_GJJ_Tally)
class GjjTallyListActivity : BaseBindingActivity<ActivityGjjTallyListBinding, GjjTallyViewModel>() {

    override fun layoutId() = R.layout.activity_gjj_tally_list
    override fun viewModelClass() = GjjTallyViewModel::class.java

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国际进港理货")

        binding.viewModel = viewModel

        viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)

        // 条目点击事件
        binding.rv.addOnItemClickListener(object : IOnItemClickListener {
            override fun onItemClick(position: Int, type: Int) {
                viewModel.onItemClick(position, type)
            }
        })
    }

    override fun onResume() {
        super.onResume()
        viewModel.refresh()
    }

}