package com.qhclh.ytzh.index.shangpin;

import android.widget.ListView;

import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseFragment;
import com.qhclh.ytzh.bean.InhouseBean;
import com.qhclh.ytzh.ui.RefreshLayout;

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

import butterknife.BindView;

/**
 * Created by 青花瓷 on 2017/12/28.
 */

public class InHouseYesFragment extends BaseFragment implements RefreshLayout.OnLoadListener {
    @BindView(R.id.lv_inhouseyes)
    ListView lv_inhouseyes;
    @BindView(R.id.rfl_inhouseyes)
    RefreshLayout rfl_inhouseyes;
    private int page =0;

    private List<InhouseBean> mList;
    private InHouseAdapter mAdapter;
    @Override
    protected int setLayout() {
        return R.layout.frag_inhouse_yes;
    }

    @Override
    protected void initView() {
        rfl_inhouseyes.setEnabled(false);
    }

    @Override
    protected void initData() {
        mList = new ArrayList<>();
        for (int i=0;i<5;i++){
            mList.add(new InhouseBean(i+5,""+i+5,""+i+5,"2017/09/09","已审核"));
        }

        mAdapter = new InHouseAdapter(getActivity(),mList);
        lv_inhouseyes.setAdapter(mAdapter);
    }

    @Override
    protected void initOper() {
        rfl_inhouseyes.setOnLoadListener(this);
    }

    @Override
    public void onLoad() {
        rfl_inhouseyes.postDelayed(new Runnable() {
            @Override
            public void run() {
                rfl_inhouseyes.setLoading(false);
                for (int i=0;i<5;i++){
                    mList.add(new InhouseBean(i,""+i,""+i,"2017/08/09","已审核"));
                }
                mAdapter.notifyDataSetChanged();
            }
        },1000);
    }
}
