package com.philisense.rdgo.adapter;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.philisense.rdgo.R;
import com.philisense.rdgo.bean.response.AllBoxBean;
import com.philisense.rdgo.bean.response.PutOutRecordBean;
import com.philisense.rdgo.databinding.ItemOrderBinding;
import com.philisense.rdgo.databinding.ItemQuareBinding;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by shaop on 2018/1/5.
 */

public class QuareAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private List<String> dataArray;
    private Context context;

    public QuareAdapter(Context context) {
        this.context = context;
        dataArray = new ArrayList<>();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        ItemQuareBinding mBindHeader = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_quare, parent, false);
        return new QuareAdapter.QuaerViewHolder(mBindHeader.getRoot());
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        QuaerViewHolder lineViewHolder = (QuaerViewHolder) holder;
        String ss = dataArray.get(position);
        lineViewHolder.itemQuareBinding.boxID.setText(ss);


    }

    @Override
    public int getItemCount() {
        return dataArray.size();
    }

    /**
     * 添加数据
     *
     * @param data 数据
     */
    public void insertData(List<String> data) {

    }

    /**
     * 初始化数据
     *
     * @param data 数据
     */
    public void setData(List<String> data) {
        dataArray = data;
        notifyDataSetChanged();
    }

    private class QuaerViewHolder extends RecyclerView.ViewHolder {

        ItemQuareBinding itemQuareBinding;

        QuaerViewHolder(View view) {
            super(view);
            itemQuareBinding = DataBindingUtil.getBinding(view);
        }

    }
}

