package com.casic.br.fragment

import androidx.fragment.app.Fragment
import com.casic.br.R
import com.casic.br.adapter.TabPagerAdapter
import com.casic.br.extensions.initLayoutImmersionBar
import com.casic.br.fragment.shop.ComponentFragment
import com.casic.br.fragment.shop.FavoriteFragment
import com.casic.br.fragment.shop.SmartHomeFragment
import com.casic.br.fragment.shop.SmartKitchenFragment
import com.casic.br.utils.LocaleConstant
import com.pengxh.kt.lite.base.KotlinBaseFragment
import kotlinx.android.synthetic.main.fragment_shop.*
import java.util.*

class ShopPageFragment : KotlinBaseFragment() {

    private var fragmentPages: ArrayList<Fragment> = ArrayList()

    init {
        fragmentPages.add(FavoriteFragment())
        fragmentPages.add(SmartKitchenFragment())
        fragmentPages.add(SmartHomeFragment())
        fragmentPages.add(ComponentFragment())
    }

    override fun initLayoutView(): Int = R.layout.fragment_shop

    override fun setupTopBarLayout() {
        requireContext().initLayoutImmersionBar(rootView)
    }

    override fun initData() {
        val subPageAdapter = TabPagerAdapter(
            fragmentPages, LocaleConstant.SHOP_PAGE_OPERATE, childFragmentManager
        )
        shopViewPager.adapter = subPageAdapter
        shopTopTabLayout.setupWithViewPager(shopViewPager)
    }

    override fun observeRequestState() {

    }

    override fun initEvent() {

    }
}