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.ActivityDeptHandleBinding;
import com.casic.dcms.ui.fragment.dept.DeptCaseAdjustFragment;
import com.casic.dcms.ui.fragment.dept.DeptCaseAuthorizeFragment;
import com.casic.dcms.ui.fragment.dept.DeptCaseDelayedFragment;
import com.casic.dcms.ui.fragment.dept.DeptCaseHandledFragment;
import com.casic.dcms.ui.fragment.dept.DeptCasePostponeFragment;
import com.casic.dcms.ui.fragment.dept.DeptCaseProcessFragment;
import com.casic.dcms.ui.fragment.dept.DeptCaseTodoFragment;
import com.casic.dcms.utils.Constant;

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

public class DeptHandleActivity extends AndroidxBaseActivity<ActivityDeptHandleBinding> {

    @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 DeptCaseTodoFragment()); //待办任务
        fragmentList.add(new DeptCaseProcessFragment()); //待处理
        fragmentList.add(new DeptCaseHandledFragment()); //已处理
        fragmentList.add(new DeptCaseAdjustFragment()); //部门调整
        fragmentList.add(new DeptCaseAuthorizeFragment()); //部门授权
        fragmentList.add(new DeptCasePostponeFragment()); //二级缓办
        fragmentList.add(new DeptCaseDelayedFragment()); //二级延期
        SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), Constant.DEPT_PAGE_TITLES, fragmentList);
        viewBinding.viewPager.setAdapter(adapter);
        //绑定TabLayout
        viewBinding.tabLayout.setupWithViewPager(viewBinding.viewPager);
        LinearLayout linearLayout = (LinearLayout) viewBinding.tabLayout.getChildAt(0);
        linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
        linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
    }

    @Override
    protected void initEvent() {

    }
}