package com.qhclh.ytzh.work.Poultrydailyreport;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseFragment;

import butterknife.BindView;

/**
 * Created by 青花瓷 on 2018/3/22.
 */

public class YuchuFragment extends BaseFragment {
    @BindView(R.id.firstContent)
    LinearLayout firstContent;
    @Override
    protected int setLayout() {
        return R.layout.frag_yuchu;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        firstContent.removeAllViews();
        for (int i=0;i<3;i++){
            View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_first,null);
            TextView name = view.findViewById(R.id.name);

            LinearLayout secondContent = view.findViewById(R.id.secondContent);
            LinearLayout main_ll = view.findViewById(R.id.main_ll);

            name.setText("场："+i);
            main_ll.setTag(i);
            secondContent.removeAllViews();
            for (int j=0;j<i+1;j++){
                View view2 = LayoutInflater.from(getActivity()).inflate(R.layout.view_second,null);
                TextView item1 = view2.findViewById(R.id.item1);
                TextView item2 = view2.findViewById(R.id.item2);
                TextView item3 = view2.findViewById(R.id.item3);
                TextView item4 = view2.findViewById(R.id.item4);

                item1.setText("item1："+i+1);
                item2.setText("item2："+i+2);
                item3.setText("item3："+i+3);
                item4.setText("item4："+i+4);
                secondContent.addView(view2);
            }



            firstContent.addView(view);
            main_ll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    System.out.println("aaa++++++tag+++"+view.getTag());
                    if ((int)view.getTag()==1){
                        System.out.println("aaa+++++tttt+++"+view.getTag());
                    }
                }
            });
        }
    }

    @Override
    protected void initOper() {

    }
}
