package com.zxhl.main.page.activity

import android.util.Log
import android.view.View
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.FragmentAdapter
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.cms.net.model.box.TabEntity
import com.zxhl.main.R
import com.zxhl.main.page.fragment.*
import kotlinx.android.synthetic.main.activity_layout_my_order.*
import kotlinx.android.synthetic.main.fragment_layout_shop.*

//我的订单
class MyOrderActivity : BaseActivity() {
    val createTitles = ArrayList<String>().apply {
        add(AppContext.get().getString(R.string.shop_order))
        add(AppContext.get().getString(R.string.magic_box_order))
    }

    val createFragments: Array<BaseFragment> = arrayOf(
        ShopOrderListFragment.newInstance(),
        MagicBoxOrderFragment.newInstance()
    )
    override fun onClick(v: View?) {

    }

    override fun before() {
        super.before()
        setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
    }

    override fun layoutID(): Int {
        return R.layout.activity_layout_my_order
    }

    override fun init() {
        id_img_back?.setOnClickListener {
            finish()
        }
        initVeiwPager()
    }

    fun initVeiwPager() {
        val adapter = FragmentAdapter(supportFragmentManager)
        order_viewPager?.adapter = adapter

        for (i in createFragments.indices) {
            adapter?.addFrag(createFragments[i], createTitles[i])
        }
        adapter?.notifyDataSetChanged()
        id_fragment_order_tab?.setViewPager(order_viewPager)
        id_fragment_order_tab?.overScrollMode = View.OVER_SCROLL_NEVER
    }


}