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.ActivityCaseOvertimeBinding;
import com.casic.dcms.ui.fragment.overtime.CaseHandledFragment;
import com.casic.dcms.ui.fragment.overtime.CaseTodoFragment;
import com.casic.dcms.utils.Constant;

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

public class OvertimeCaseActivity extends AndroidxBaseActivity<ActivityCaseOvertimeBinding> {

    @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(new CaseTodoFragment());
        fragmentList.add(new CaseHandledFragment());
        SubViewPagerAdapter adapter = new
                SubViewPagerAdapter(getSupportFragmentManager(), Constant.CASE_PAGE_TITLES, fragmentList);
        viewBinding.overtimeViewPager.setAdapter(adapter);
        //绑定TabLayout
        viewBinding.overtimeTabLayout.setupWithViewPager(viewBinding.overtimeViewPager);
        LinearLayout linearLayout = (LinearLayout) viewBinding.overtimeTabLayout.getChildAt(0);
        linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
        linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
    }

    @Override
    protected void initEvent() {

    }
}