package com.qhclh.ytzh.work.tablepoultry.changle;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseFragment;
import com.qhclh.ytzh.bean.TablePBean;
import com.qhclh.ytzh.work.tablepoultry.ReportActivity;
import com.qhclh.ytzh.work.tablepoultry.XFactryAdapter;

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

import butterknife.BindView;

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

public class ChangleFragment extends BaseFragment {
    @BindView(R.id.lv_changle)
    ListView lv_changle;

    private List<TablePBean> list;
    private XFactryAdapter adapter;
    @Override
    protected int setLayout() {
        return R.layout.fragment_changle;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        list = new ArrayList<>();
        for (int i=0;i<8;i++){
            list.add(new TablePBean(i,i+1,"aaaa"+i,"22"+i,"333"+i,"5555"+i));
        }

        adapter = new XFactryAdapter(getActivity(),list);
        lv_changle.setAdapter(adapter);
    }

    @Override
    protected void initOper() {
        lv_changle.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                startActivity(new Intent(getActivity(), ReportActivity.class));
            }
        });
    }
}
