package com.hongyegroup.cpt_parttime.ui

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.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.FragmentParttimeJobProfileBinding
import com.hongyegroup.cpt_parttime.mvvm.PartJobProfileViewModel
import com.scwang.smart.refresh.layout.api.RefreshLayout
import com.scwang.smart.refresh.layout.listener.OnRefreshListener

/**
 * 兼职个人信息页面
 */
class PartJobProfileFragment : YYBaseVDBLoadingFragment<PartJobProfileViewModel, FragmentParttimeJobProfileBinding>(), IFragmentRefresh,
    OnRefreshListener {

    override fun getDataBindingConfig(): DataBindingConfig {
        return DataBindingConfig(R.layout.fragment_parttime_job_profile, 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 {

    }


}