package com.ycgis.macall.personalcenter.v.activity.applyfo;


import android.os.Bundle;
import android.view.View;

import com.rs.macall.androidx.basemodel.base.BaseViewBindActivity;
import com.rs.macall.androidx.basemodel.base.BaseViewBindFragment;
import com.rs.macall.androidx.basemodel.base.ViewBindFragmentAdapter;
import com.rs.macall.androidx.basemodel.callback.CustomClickListener;
import com.ycgis.macall.personalcenter.databinding.ActivityMyApplyForBinding;
import com.ycgis.macall.personalcenter.v.adapter.InitiateRecordAdapter;
import com.ycgis.macall.personalcenter.v.fragment.ApplyOkFragment;
import com.ycgis.macall.personalcenter.v.fragment.ApplyRecordFragment;

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

/**
 * 我的申请
 */
public class MyApplyForActivity extends BaseViewBindActivity<ActivityMyApplyForBinding> {
    private InitiateRecordAdapter adapter;
    private int page;
    private final int pageSize = 10;
    private int total;
    private int refreshType;

    @Override
    protected ActivityMyApplyForBinding getViewBinding() {
        return ActivityMyApplyForBinding.inflate(getLayoutInflater());
    }

    @Override
    protected boolean isImmersiveStatusBar() {
        return true;
    }

    @Override
    protected void init() {
        viewBinding.contentTitle.setText("我的申请");
        viewBinding.titleleft.setOnClickListener(new CustomClickListener() {
            @Override
            public void onSingleClick(View v) {
                finish();
            }
        });

    }

    @Override
    protected void readInstanceState(Bundle savedInstanceState) {

    }

    @Override
    protected void start() {
        List<BaseViewBindFragment> dataList = new ArrayList<>();
        dataList.add(new ApplyRecordFragment());
        dataList.add(new ApplyOkFragment());
        ViewBindFragmentAdapter adapter = new ViewBindFragmentAdapter(getSupportFragmentManager(),dataList);
        viewBinding.vpPage.setAdapter(adapter);
//        viewBinding.vpPage.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
//            @Override
//            public void onPageScrollStateChanged(int state) {
//                if (state == 2){
//                    int currentItem = viewBinding.vpPage.getCurrentItem();
//                    skip(currentItem);
//                }
//            }
//        });
        viewBinding.tabLayout.setViewPager(viewBinding.vpPage,new String[]{"历史申请","申请通过"});
    }

}