package com.hongyegroup.cpt_main.ui

import android.os.Bundle
import com.guadou.cs_cptservices.base.fragment.YYBaseVDBFragment
import com.guadou.cs_cptservices.interfaces.IFragmentRefresh
import com.guadou.lib_baselib.bean.DataBindingConfig
import com.guadou.lib_baselib.utils.CommUtils
import com.hongyegroup.cpt_main.BR
import com.hongyegroup.cpt_main.R
import com.hongyegroup.cpt_main.databinding.FragmentProfileBinding
import com.hongyegroup.cpt_main.mvvm.ProfileViewModel
import com.scwang.smart.refresh.layout.api.RefreshLayout
import com.scwang.smart.refresh.layout.listener.OnRefreshListener

/**
 * 首页列表
 */
class ProfileFragment : YYBaseVDBFragment<ProfileViewModel, FragmentProfileBinding>(), IFragmentRefresh,
    OnRefreshListener {

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

    override fun startObserve() {
    }

    override fun init(savedInstanceState: Bundle?) {

        initView()
        initData()
        initListener()
    }

    private fun initView() {


    }

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

    private fun initListener() {

    }

    override fun onRefresh(refreshLayout: RefreshLayout) {

    }

    override fun scrollTopRefresh() {

    }

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

        //跳转到邀请朋友界面
        fun gotoInviteFriendsActivity(){

            InviteFriendsActivity.startInstance()

        }

        //跳转到Settings界面
        fun  gotoSettingsActivity(){

            SettingsActivity.startInstance()

        }

    }


}