package com.zxhl.main.page.fragment

import android.view.View
import androidx.fragment.app.Fragment
import com.flyco.tablayout.listener.CustomTabEntity
import com.ym.chat.fragment.ChatFragment
import com.zxhl.main.R
import com.zxhl.main.page.view.BaseViewPagerFragment
import com.zxhl.main.page.view.TabEntity

class MessageFragment: BaseViewPagerFragment() {
    override val createTitles = ArrayList<CustomTabEntity>().apply {
        add(TabEntity("Message"))
        add(TabEntity("Like"))

    }

    override val createFragments: Array<Fragment> = arrayOf(
        ChatFragment(),
        LikeFragment.newInstance()
    )

    override fun layoutID(): Int {

        return R.layout.fragment_layout_message
    }

    override fun init(view: View?) {
        viewPager?.currentItem = 0
    }

    override fun lazyLoad() {
        super.lazyLoad()
        if (isVisible && isInitial) {
            createFragments[viewPager?.currentItem ?: 0].userVisibleHint = true
        }
    }

    override fun onDestroy() {
        super.onDestroy()


    }

}