package com.zhilin.patrol.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.WindowManager;

import com.zhilin.patrol.R;
import com.zhilin.patrol.adapter.FragmentAdapter;
import com.zhilin.patrol.bean.LoginEntity;
import com.zhilin.patrol.ui.fragment.PointRecordFragment;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class InfoUploadActivity extends BaseActivity implements View.OnClickListener{
    @BindView(R.id.tab_layout)
    TabLayout mTabLayout;
    @BindView(R.id.view_pager)
    ViewPager mViewPager;



    private ArrayList<String> mListTitle;
    private ArrayList<Fragment> mListFragment;
    private FragmentAdapter mAdapter;
    private LoginEntity.InfoListBean.UserInfoBean mUserInfo;
    private int nNum;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_patrol_record);
        mUserInfo = (LoginEntity.InfoListBean.UserInfoBean) getIntent().getSerializableExtra("userInfo");
        nNum=getIntent().getIntExtra("num",0);
        ButterKnife.bind(this);
        setTitle("巡查点位问题上报");
//        request();
        init();
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    }

    private void init() {
        mListTitle = new ArrayList<>();
        mListTitle.add("现有点位修改");
        mListTitle.add("新增点位");

        mTabLayout.setTabMode(TabLayout.MODE_FIXED);

        mTabLayout.addTab(mTabLayout.newTab().setText(mListTitle.get(0)));
        mTabLayout.addTab(mTabLayout.newTab().setText(mListTitle.get(1)));

        mListFragment = new ArrayList<>();

        mListFragment.add(PointRecordFragment.newInstance(1));
        mListFragment.add(PointRecordFragment.newInstance(2));

        mAdapter = new FragmentAdapter(getSupportFragmentManager(), this, mListFragment, mListTitle);
        //设置适配器
        mViewPager.setAdapter(mAdapter);
        mViewPager.setOffscreenPageLimit(2);
        mTabLayout.setupWithViewPager(mViewPager);

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onClick(View view) {

    }
}
