package com.swago.baseswago.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.swago.baseswago.activity.BaseActivity
import com.swago.baseswago.util.NetUtil
import com.zy.multistatepage.MultiStateContainer
import com.zy.multistatepage.MultiStatePage
import com.zy.multistatepage.state.ErrorState

/**
 *@date 2021/8/21 12:45
 *description:
 */
abstract  class BaseXFragment<T: ViewBinding> : BaseFragment<T>() {

    lateinit var multiStateContainer: MultiStateContainer

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        super.onCreateView(inflater, container, savedInstanceState)
        multiStateContainer = MultiStatePage.bindMultiState(binding.root)
        return multiStateContainer
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initOther()
        initLiveData()
        loadData()
    }

    abstract fun loadData()
    abstract fun initOther()
    abstract fun initLiveData()
}