package com.lukouguoji.gjc.activity

import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import androidx.viewpager2.widget.ViewPager2
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.adapt.GjcYiKuListSwitchAdapter
import com.lukouguoji.gjc.fragment.GjcYiKu2Fragment
import com.lukouguoji.gjc.fragment.GjcYiKuFragment
import com.lukouguoji.module_base.BaseActivity
import com.lukouguoji.module_base.router.ARouterConstants


@Route(path = ARouterConstants.ACTIVITY_URL_GJC_YI_KU)
class GjcYiKuListActivity : BaseActivity(), View.OnClickListener {

    val viewContainter = ArrayList<View>()
    var pager: ViewPager? = null


    private fun initView() {
        val listFragment = arrayListOf<Fragment>()
        listFragment.add(GjcYiKu2Fragment())
        listFragment.add(GjcYiKuFragment())
        val viewPager2 = findViewById<ViewPager2>(R.id.viewpager2)
        val viewPagerAdapter = GjcYiKuListSwitchAdapter(listFragment, supportFragmentManager, lifecycle)
        viewPager2.adapter = viewPagerAdapter
        viewPager2.setCurrentItem(1, false)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_gjc_yi_ku_list)
        initView()
    }

    override fun onClick(v: View?) {
        v?.let {
            when (it.id) {
                else -> {
                    Toast.makeText(this, "未找到对应操作", Toast.LENGTH_SHORT).show()
                }
            }
        }
    }

}