package com.casic.dcms.view.sanbao;

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.ActivitySanBaoBinding;
import com.casic.dcms.fragment.sanbao.SanBaoHandledFragment;
import com.casic.dcms.fragment.sanbao.SanBaoTodoFragment;
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;

public class SanBaoCaseActivity extends AndroidxBaseActivity<ActivitySanBaoBinding> {

    @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 SanBaoTodoFragment());
        fragmentList.add(new SanBaoHandledFragment());
        SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), LocaleConstant.CASE_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() {

    }
}