package com.sheep.gamegroup.view.activity;

import android.app.Activity;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;

import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
import com.sheep.gamegroup.absBase.BaseActivity;
import com.sheep.gamegroup.util.CommonUtil;
import com.sheep.gamegroup.view.fragment.FgtMyDownloadWelfareList;
import com.sheep.gamegroup.view.fragment.FgtMyGift;
import com.sheep.gamegroup.view.fragment.FgtWelfareUseRecord;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.SheepApp;
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;

import butterknife.BindView;

/**
 * Created by realicing on 2018/8/28.
 * realicing@sina.com
 */
public class ActMyWelfare extends BaseActivity {
    @BindView(R.id.indicator)
    TabLayout indicator;
    @BindView(R.id.pager)
    ViewPager pager;
    @Override
    protected int getLayoutId() {
        return R.layout.common_tab_vp;
    }


    @Override
    public void initView() {
        activity = this;
        TitleBarUtils.getInstance()
                .setShowOrHide(this, true)
                .setTitle(this, "我的福利")
                .setTitleFinish(this);

    }

    private Activity activity;


    private TitleFragmentListAdapter mAdapter;
    @Override
    public void initListener() {
        mAdapter = new TitleFragmentListAdapter(getSupportFragmentManager());
        mAdapter.add(new FgtMyDownloadWelfareList(), "下载福利");
        mAdapter.add(new FgtMyGift(), "我的礼包");
        mAdapter.add(new FgtWelfareUseRecord(), "使用记录");
        pager.setAdapter(mAdapter);
        indicator.setupWithViewPager(pager);
        pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int i, float v, int i1) {

            }

            @Override
            public void onPageSelected(int i) {
            }

            @Override
            public void onPageScrollStateChanged(int i) {

            }
        });
        pager.setOffscreenPageLimit(3);
        CommonUtil.getInstance().reflex(indicator, activity);
    }


    @Override
    public void initData() {
    }

}
