package com.wisdom.pigs.ui.act1;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.wisdom.pigs.R;
import com.wisdom.pigs.adapters.PigHomeAdapter;
import com.wisdom.pigs.adapters.PigListAdapter;
import com.wisdom.pigs.base.BaseActivity;
import com.wisdom.pigs.bean.WWBean;

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

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * A login screen that offers login via email/password.
 */
public class PigsListActivity extends BaseActivity {


    @BindView(R.id.iv_base_activity_back)
    ImageView ivBaseActivityBack;
    @BindView(R.id.tv_title_center)
    TextView tvTitleCenter;
    @BindView(R.id.tv_title_right)
    TextView tvTitleRight;
    @BindView(R.id.rl_base_activity_backround)
    RelativeLayout rlBaseActivityBackround;
    @BindView(R.id.et_bank_search)
    EditText etBankSearch;
    @BindView(R.id.mRecyclerView)
    RecyclerView mRecyclerView;

    private PigListAdapter.OnRecyclerviewItemClickListener onRecyclerviewClickListener;
    private PigListAdapter adapter;

    @Override
    protected int setView() {
        return R.layout.activity_piglist;
    }

    @Override
    public void initView() {
        ivBaseActivityBack.setVisibility(View.VISIBLE);
        tvTitleRight.setVisibility(View.GONE);
        ivBaseActivityBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        Intent intent = getIntent();
        intent.getStringExtra("Name");
        tvTitleCenter.setText(intent.getStringExtra("Name") + "");

        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
        LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
        mRecyclerView.setLayoutManager(mLayoutManager);
        onRecyclerviewClickListener = new PigListAdapter.OnRecyclerviewItemClickListener() {
            @Override
            public void onItemClickListener(View v, int i1) {


            }
        };

        WWBean wwBean1 = new WWBean("ABC-0001", "133kg", 1);
        WWBean wwBean2 = new WWBean("ABC-0002", "136kg", 1);
        WWBean wwBean3 = new WWBean("ABC-0003", "138kg", 1);
        WWBean wwBean4 = new WWBean("ABC-0004", "130kg", 0);
        WWBean wwBean5 = new WWBean("ABC-0005", "142kg", 0);

        List<WWBean> list = new ArrayList<>();
        list.add(wwBean1);
        list.add(wwBean2);
        list.add(wwBean3);
        list.add(wwBean4);
        list.add(wwBean5);

        adapter = new PigListAdapter(this, list, onRecyclerviewClickListener);
        mRecyclerView.setAdapter(adapter);
    }

}

