package com.casic.dcms.view.handle;

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.ActivityCaseHandleBinding;
import com.casic.dcms.fragment.handle.CaseHandledFragment;
import com.casic.dcms.fragment.handle.CaseTodoFragment;
import com.casic.dcms.utils.LinearLayoutHelper;
import com.casic.dcms.utils.ViewGroupKit;
import com.pengxh.androidx.lite.base.AndroidxBaseActivity;

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

public class HandleCaseActivity extends AndroidxBaseActivity<ActivityCaseHandleBinding> {

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

    @Override
    protected void setupTopBarLayout() {
        ViewGroupKit.initImmersionBar(binding.rootView, this, true, R.color.white);

        binding.titleBarLayout.titleView.setText("案卷处理");
        binding.titleBarLayout.leftBackView.setOnClickListener(v -> finish());
    }

    @Override
    protected void observeRequestState() {

    }

    @Override
    protected void initOnCreate(@Nullable Bundle savedInstanceState) {
        List<Fragment> fragmentList = new ArrayList<>();
        fragmentList.add(new CaseTodoFragment());
        fragmentList.add(new CaseHandledFragment());
        SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), pageTitles, fragmentList);
        binding.handleViewPager.setAdapter(adapter);
        //绑定TabLayout
        binding.handleTabLayout.setupWithViewPager(binding.handleViewPager);
        LinearLayout linearLayout = (LinearLayout) binding.handleTabLayout.getChildAt(0);
        LinearLayoutHelper.setDivider(this, linearLayout);
    }

    @Override
    protected void initEvent() {

    }
}