package com.casic.dcms.view.dept;

import android.os.Bundle;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;
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.dept.DeptCaseAdjustFragment;
import com.casic.dcms.fragment.dept.DeptCaseAuthorizeFragment;
import com.casic.dcms.fragment.dept.DeptCaseDelayedFragment;
import com.casic.dcms.fragment.dept.DeptCaseHandledFragment;
import com.casic.dcms.fragment.dept.DeptCasePostponeFragment;
import com.casic.dcms.fragment.dept.DeptCaseProcessFragment;
import com.casic.dcms.fragment.dept.DeptCaseTodoFragment;
import com.casic.dcms.utils.LinearLayoutHelper;
import com.casic.dcms.utils.LocaleConstant;
import com.casic.dcms.utils.ViewGroupKit;
import com.pengxh.androidx.lite.base.AndroidxBaseActivity;
import com.pengxh.androidx.lite.widget.TitleBarView;

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

/**
 * TODO 写的太繁琐，后续有机会再优化
 */
public class DeptHandleActivity extends AndroidxBaseActivity<ActivityDeptHandleBinding> {

    @Override
    protected void setupTopBarLayout() {
        ViewGroupKit.initImmersionBar(binding.rootView, this, true, R.color.white);
        binding.titleView.setOnClickListener(new TitleBarView.OnClickListener() {
            @Override
            public void onLeftClick() {
                finish();
            }

            @Override
            public void onRightClick() {

            }
        });
    }

    @Override
    protected void observeRequestState() {

    }

    @Override
    protected void initOnCreate(@Nullable Bundle savedInstanceState) {
        List<Fragment> fragmentList = new ArrayList<>();
        fragmentList.add(new DeptCaseTodoFragment()); //待办任务
        fragmentList.add(new DeptCaseProcessFragment()); //待处理
        fragmentList.add(new DeptCaseAdjustFragment()); //部门调整
        fragmentList.add(new DeptCasePostponeFragment()); //二级缓办
        fragmentList.add(new DeptCaseAuthorizeFragment()); //部门授权
        fragmentList.add(new DeptCaseDelayedFragment()); //二级延期
        fragmentList.add(new DeptCaseHandledFragment()); //已处理
        SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), LocaleConstant.DEPT_PAGE_TITLES, fragmentList);
        binding.viewPager.setAdapter(adapter);
        //绑定TabLayout
        binding.tabLayout.setupWithViewPager(binding.viewPager);
        LinearLayout linearLayout = (LinearLayout) binding.tabLayout.getChildAt(0);
        LinearLayoutHelper.setDivider(this, linearLayout);
    }

    @Override
    protected void initEvent() {

    }
}