package com.lukouguoji.gjj.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.ActivityGjjManifestBinding
import com.lukouguoji.gjj.holder.GjjManifestListViewHolder
import com.lukouguoji.gjj.viewModel.GjjManifestListViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.base.CommonAdapter
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.router.ARouterConstants

@Deprecated("旧的实现")
@Route(path = ARouterConstants.ACTIVITY_URL_GJJ_MANIFEST)
class GjjManifestListActivity :
    BaseBindingActivity<ActivityGjjManifestBinding, GjjManifestListViewModel>() {

    override fun layoutId() = R.layout.activity_gjj_manifest

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国际进港舱单")
        binding.viewModel = viewModel

        binding.rv.addOnItemClickListener(viewModel)

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

        viewModel.init(requireContext())
    }

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

    override fun viewModelClass() = GjjManifestListViewModel::class.java

    companion object {
        @JvmStatic
        fun start(context: Context) {
            val starter = Intent(context, GjjManifestListActivity::class.java)
            context.startActivity(starter)
        }
    }
}