package com.bjzc.bhzhgd.activity.sbxdj;


import com.bjzc.bhzhgd.R;
import com.bjzc.bhzhgd.base.BaseActivity;
import com.google.android.material.tabs.TabLayout;
import java.util.ArrayList;
import java.util.List;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

/**
 * 设备巡点检管理--现场点检
 */
public class DjMainActivity extends BaseActivity {

    private ViewPager mViewPager;
    private TabLayout mTabLayout;
    private List<Fragment> fragments = new ArrayList<>();

    @Override
    public int getContentViewID() {
        return R.layout.activity_maindj;
    }

    protected void initView() {

    }

    public void initData() {
        setTitle("点检数据管理");
        mViewPager = findViewById(R.id.viewpager);
        setBack();
        initViewPager();
    }

    private void initViewPager() {
        mTabLayout = findViewById(R.id.tabs);
        List<String> titles = new ArrayList<>();
        titles.add("数据下载");
        titles.add("数据上传");
        for (int i = 0; i < titles.size(); i++) {
            mTabLayout.addTab(mTabLayout.newTab().setText(titles.get(i)));
        }
        fragments.add(new XzjhFragment());
        fragments.add(new DjdscFragment());
        FragmentAdapter mFragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragments, titles);
        mViewPager.setAdapter(mFragmentAdapter);
        mTabLayout.setupWithViewPager(mViewPager);
    }
}