package com.unis.sxzcl.ui.audit;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;

import com.unis.sxzcl.base.BaseFragment;
import com.unis.sxzcl.databinding.FragmentAuditHomeBinding;
import com.unis.sxzcl.widget.TabFragmentPagerAdapter;

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

/**
 *
 * 包名: com.unis.sxzcl.ui.audit
 * 类名: AuditHomeFragment
 * 作用描述:
 * 创建人: mQ
 * 创建时间: 2020/11/25 20:27
 * 更新人:
 * 更新时间: 2020/11/25 20:27
 * 更新说明:
 * 版本号: 1.0
 */
public class AuditHomeFragment extends BaseFragment<FragmentAuditHomeBinding> {

    private List<String> mTabs = Arrays.asList("待处理", "已处理");
    private List<Fragment> mFragments;

    @Override
    protected FragmentAuditHomeBinding getViewBinding(LayoutInflater inflater, ViewGroup container) {
        return FragmentAuditHomeBinding.inflate(inflater,container,false);
    }

    @Override
    protected void init() {
        mBinding.bar.setLeftClickListener(v -> finish());
        mBinding.bar.setTitle("审批");

        initFragment();
        mBinding.tabLayout.setupWithViewPager(mBinding.viewPager);
        mBinding.viewPager.setAdapter(new TabFragmentPagerAdapter(getChildFragmentManager(), mTabs, mFragments));
        mBinding.viewPager.setOffscreenPageLimit(mFragments.size());
    }

    private void initFragment() {
        mFragments = new ArrayList<>();
        mFragments.add(new AuditListFragment());
        mFragments.add(new AuditListFragment());
    }

    @Override
    protected void onFirstShow() {

    }
}
