package com.casic.dcms.view.handle;

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.ActivityCaseHandleBinding;
import com.casic.dcms.fragment.handle.CaseHandledFragment;
import com.casic.dcms.fragment.handle.CaseOverTimeFragment;
import com.casic.dcms.fragment.handle.CaseTodoFragment;
import com.casic.dcms.fragment.handle.CaseUrgentFragment;
import com.casic.dcms.utils.LinearLayoutHelper;
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 HandleCaseActivity extends AndroidxBaseActivity<ActivityCaseHandleBinding> {

    private final String[] pageTitles = new String[]{"超时案卷", "紧急案卷", "待办案卷", "已办案卷"};

    @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 CaseOverTimeFragment());
        fragmentList.add(new CaseUrgentFragment());
        fragmentList.add(new CaseTodoFragment());
        fragmentList.add(new CaseHandledFragment());
        SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), pageTitles, fragmentList);
        viewBinding.handleViewPager.setAdapter(adapter);
        //绑定TabLayout
        viewBinding.handleTabLayout.setupWithViewPager(viewBinding.handleViewPager);
        LinearLayout linearLayout = (LinearLayout) viewBinding.handleTabLayout.getChildAt(0);
        LinearLayoutHelper.setDivider(this, linearLayout);
    }

    @Override
    protected void initEvent() {

    }
}