package com.casic.dcms.view.urgent;

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.ActivityCaseUrgentBinding;
import com.casic.dcms.fragment.urgent.CaseHandledFragment;
import com.casic.dcms.fragment.urgent.CaseTodoFragment;
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 UrgentCaseActivity extends AndroidxBaseActivity<ActivityCaseUrgentBinding> {

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

    @Override
    protected void initEvent() {

    }
}