package com.casic.dcms.view.department;

import android.widget.LinearLayout;

import androidx.fragment.app.Fragment;

import com.casic.dcms.R;
import com.casic.dcms.adapter.SubViewPagerAdapter;
import com.casic.dcms.databinding.ActivityDeptHandleBinding;
import com.casic.dcms.fragment.department.DeptCaseAdjustFragment;
import com.casic.dcms.fragment.department.DeptCaseAuthorizeFragment;
import com.casic.dcms.fragment.department.DeptCaseDelayedFragment;
import com.casic.dcms.fragment.department.DeptCaseHandledFragment;
import com.casic.dcms.fragment.department.DeptCasePostponeFragment;
import com.casic.dcms.fragment.department.DeptCaseProcessFragment;
import com.casic.dcms.fragment.department.DeptCaseTodoFragment;
import com.casic.dcms.utils.LinearLayoutHelper;
import com.casic.dcms.utils.LocaleConstant;
import com.gyf.immersionbar.ImmersionBar;
import com.pengxh.androidx.lite.base.AndroidxBaseActivity;
import com.pengxh.androidx.lite.hub.IntHub;
import com.pengxh.androidx.lite.utils.ImmerseStatusBarManager;

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

public class DeptHandleActivity extends AndroidxBaseActivity<ActivityDeptHandleBinding> {

    @Override
    protected void setupTopBarLayout() {
        ImmerseStatusBarManager.setColor(this, IntHub.convertColor(this, R.color.white));
        ImmersionBar.with(this).statusBarDarkFont(true).init();

        viewBinding.titleBarLayout.titleView.setText("部门处置");
        viewBinding.titleBarLayout.leftBackView.setOnClickListener(v -> finish());
    }

    @Override
    protected void observeRequestState() {

    }

    @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(), LocaleConstant.DEPT_PAGE_TITLES, fragmentList);
        viewBinding.viewPager.setAdapter(adapter);
        //绑定TabLayout
        viewBinding.tabLayout.setupWithViewPager(viewBinding.viewPager);
        LinearLayout linearLayout = (LinearLayout) viewBinding.tabLayout.getChildAt(0);
        LinearLayoutHelper.setDivider(this, linearLayout);
    }

    @Override
    protected void initEvent() {

    }
}