package com.qhclh.ytzh.work.breedpoultry;

import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.Spinner;

import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseActivity;
import com.qhclh.ytzh.bean.FactryBean;

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

import butterknife.BindView;

/**
 * Created by 青花瓷 on 2017/11/30.
 */
///< 筛选查看3项指标
public class DatanalysisSActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.gv_dataanaly)
    GridView gv_dataanaly;
    @BindView(R.id.buildinghome)
    Spinner buildinghome;
    private List<FactryBean> factryBeanList;
    private FactryAdapter factryAdapter;
    private List<String> list = new ArrayList<String>();


    private List<Boolean> factryCheck;
    @Override
    protected int setLayoutId() {
        return R.layout.act_datanaly_s;
    }

    @Override
    protected void initView() {
        initToolbar(mToolbar, "筛选", new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    protected void initData() {
        factryBeanList = new ArrayList<>();
        factryCheck = new ArrayList<>();
        for (int i=0;i<10;i++){
            factryBeanList.add(new FactryBean(i,"adf"+i));
        }
        for (int i=0;i<factryBeanList.size();i++){
            factryCheck.add(factryBeanList.get(i).isCheck());
        }
        factryAdapter = new FactryAdapter(this,factryBeanList,factryCheck);
        gv_dataanaly.setAdapter(factryAdapter);

        list.add("苹果");
        list.add("香蕉");
        list.add("橘子");
        list.add("香蕉");
        ArrayAdapter<String> adapter=new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,list);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        buildinghome.setAdapter(adapter);
    }

    @Override
    protected void initOper() {
        buildinghome.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

            }

            @Override
            public void onNothingSelected(AdapterView<?> adapterView) {

            }
        });
    }
}
