package com.kfzs.duanduan.mine;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sheep.gamegroup.view.fragment.FgtAudit;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.utils.G;

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

/**
 * created on：2018/8/22 on 4:57
 * created by: Administrator
 * 描述:
 */
public class ShenheAdapter extends FragmentPagerAdapter {
    private Context mContext;
    private List<Object> mListFragment = new ArrayList<>();
    private List<Object> mTitles = new ArrayList<>();

    public ShenheAdapter(FragmentManager fm, Context mContext) {
        super(fm);
        this.mContext = mContext;
    }

    public void add(Fragment fragment, String title) {
        mListFragment.add(fragment);
        mTitles.add(title);
    }

    @Override
    public Fragment getItem(int position) {
        return (Fragment) mListFragment.get(position);
    }

    @Override
    public int getCount() {
        return mListFragment.size();
    }

    @Override
    public int getItemPosition(Object object) {
        return super.getItemPosition(object);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return (CharSequence) mTitles.get(position);
    }

    public View getTabView(int position) {
        View v = LayoutInflater.from(mContext).inflate(R.layout.view_add_fgtmainaudit, null);
        ImageView imageView = v.findViewById(R.id.iv_img);
        TextView textView1 = v.findViewById(R.id.tv_text);
        if (position == 0) {
            textView1.setText("审核中");
        } else if (position == 1) {
            textView1.setText("审核成功");
        } else if (position == 2) {
            textView1.setText("审核失败");
            if (FgtAudit.newInstance(3).type == 3) {
                if (FgtAudit.newInstance(3).etyList != null) {
                    if (FgtAudit.newInstance(3).etyList.get(0).getStatus() == 6) {
                        imageView.setVisibility(View.VISIBLE);
                    } else {
                        imageView.setVisibility(View.GONE);
                    }
                }
            }
        }

        return v;
    }
}
