package com.casic.dcms.ui;

import android.widget.LinearLayout;

import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import com.casic.dcms.R;
import com.casic.dcms.adapter.SubViewPagerAdapter;
import com.casic.dcms.base.AndroidxBaseActivity;
import com.casic.dcms.databinding.ActivityHighEventBinding;
import com.casic.dcms.ui.fragment.ExcelFragment;
import com.casic.dcms.ui.fragment.PieChartFragment;
import com.casic.dcms.utils.Constant;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : Pengxh
 * @time : 2021/4/16 8:44
 * @email : 290677893@qq.com
 */
public class HighEventListActivity extends AndroidxBaseActivity<ActivityHighEventBinding> {

    private static final String TAG = HighEventListActivity.class.getSimpleName();

    @Override
    protected void setupTopBarLayout() {
        viewBinding.titleBarLayout.titleView.setText("高发问题");
        viewBinding.titleBarLayout.leftBackView.setOnClickListener(v -> finish());
    }

    @Override
    protected void initData() {
        List<Fragment> fragmentList = new ArrayList<>();
        fragmentList.add(ExcelFragment.newInstance(TAG));
        fragmentList.add(PieChartFragment.newInstance(TAG));
        SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), Constant.CHART_PAGE_TITLES, fragmentList);
        viewBinding.eventViewPager.setAdapter(adapter);
        //绑定TabLayout
        viewBinding.eventTabLayout.setupWithViewPager(viewBinding.eventViewPager);
        LinearLayout linearLayout = (LinearLayout) viewBinding.eventTabLayout.getChildAt(0);
        linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
        linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
    }

    @Override
    protected void initEvent() {

    }
}