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 InHouseNoFragment extends BaseFragment implements RefreshLayout.OnLoadListener {
    @BindView(R.id.lv_inhouseno)
    ListView lv_inhouseno;
    @BindView(R.id.rfl_inhouseno)
    RefreshLayout rfl_inhouseno;
    private int page =0;

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

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

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

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

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

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