package com.lukouguoji.gnc.page.assemble.list

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gnc.R
import com.lukouguoji.gnc.databinding.ActivityGncAssembleListBinding
import com.lukouguoji.module_base.adapter.setCommonAdapter
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.ktx.getLifecycleOwner
import com.lukouguoji.module_base.router.ARouterConstants

@Route(path = ARouterConstants.ACTIVITY_URL_GNC_ASSEMBLE_LIST)
class GncAssembleListActivity :
    BaseBindingActivity<ActivityGncAssembleListBinding, GncAssembleListViewModel>() {

    override fun layoutId() = R.layout.activity_gnc_assemble_list

    override fun viewModelClass(): Class<GncAssembleListViewModel> {
        return GncAssembleListViewModel::class.java
    }

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国内出港组装")
        binding.viewModel = viewModel
        viewModel.pageModel.bindSmartRefreshLayout(
            binding.srl,
            binding.rv,
            viewModel,
            getLifecycleOwner()
        )

        binding.rv.addOnItemClickListener(viewModel)
    }

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

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