package com.hongyegroup.cpt_parttime.ui.main

import android.os.Bundle
import android.view.View
import com.guadou.cs_cptservices.base.fragment.YYBaseVDBLoadingFragment
import com.guadou.cs_cptservices.interfaces.IFragmentRefresh
import com.guadou.lib_baselib.base.vm.EmptyViewModel
import com.guadou.lib_baselib.bean.DataBindingConfig
import com.guadou.lib_baselib.utils.CommUtils
import com.guadou.lib_baselib.view.gloading.GLoadingTitleStatus
import com.guadou.lib_baselib.view.gloading.Gloading
import com.guadou.lib_baselib.view.gloading.GloadingGlobalAdapter
import com.hongyegroup.cpt_parttime.BR
import com.hongyegroup.cpt_parttime.R
import com.hongyegroup.cpt_parttime.databinding.FragmentJobTrainBinding
import com.scwang.smart.refresh.layout.api.RefreshLayout
import com.scwang.smart.refresh.layout.listener.OnRefreshListener

/**
 * 首页列表的培训Web页面
 */
class PartTimeTrainFragment : YYBaseVDBLoadingFragment<EmptyViewModel, FragmentJobTrainBinding>(), IFragmentRefresh,
    OnRefreshListener {

    override fun getDataBindingConfig(): DataBindingConfig {
        return DataBindingConfig(R.layout.fragment_job_train, BR.viewModel, mViewModel)
            .addBindingParams(BR.click, ClickProxy())
    }

    //重新生成GLoading对象-跳动动画
    override fun generateGLoading(view: View): Gloading.Holder {
        return Gloading.from(GloadingGlobalAdapter())
            .wrap(view, GLoadingTitleStatus(true, true, true))
            .withRetry { onGoadingRetry() }
    }

    override fun startObserve() {
    }

    override fun init(savedInstanceState: Bundle?) {

        initRV()
        initData()
        initListener()
    }

    private fun initData() {
        showStateLoading()
        CommUtils.getHandler().postDelayed({
            showStateSuccess()
        }, 1500)
    }

    override fun onGoadingRetry() {

    }

    private fun initListener() {

    }

    override fun onRefresh(refreshLayout: RefreshLayout) {

    }


    private fun initRV() {

    }

    override fun scrollTopRefresh() {

    }

    /**
     * DataBinding事件处理
     */
    inner class ClickProxy {

    }


}