| | |
| | | package com.bsk.zhangbo.demoforbsk.adapter;
|
| | |
|
| | | import android.content.Context;
|
| | | import android.view.View;
|
| | | import android.view.ViewGroup;
|
| | | import android.widget.ImageView;
|
| | | import android.widget.LinearLayout;
|
| | | import android.widget.RelativeLayout;
|
| | | import android.widget.TextView;
|
| | | import android.widget.Toast;
|
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import com.bsk.zhangbo.demoforbsk.ui.activity.MainActivity;
|
| | | import com.bsk.zhangbo.demoforbsk.ui.fragment.VisitorRegisterFragment;
|
| | | import com.bsk.zhangbo.demoforbsk.util.Constant;
|
| | | import com.camnter.easyrecyclerview.adapter.EasyRecyclerViewAdapter;
|
| | | import com.camnter.easyrecyclerview.holder.EasyRecyclerViewHolder;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.discern.query.item.VisitorQueryItem;
|
| | |
|
| | | /**
|
| | | * Created by Sinoe on 2017/2/23.
|
| | |
| | | private TextView mTvName, mTvDepartment;
|
| | | public static final int TYPE_NAME = 10000;
|
| | | public static final int TYPE_DEPARTMENT = 10001;
|
| | | private TextView mToNameTv;
|
| | | private TextView mToDepartmentTv;
|
| | |
|
| | | public VisitorRecyclerViewAdapter(Context mContext, int type) {
|
| | | this.mContext = mContext;
|
| | |
| | | * @param holder
|
| | | * @param posistion
|
| | | */
|
| | | private void VisitorFromViewHolder(EasyRecyclerViewHolder holder, int posistion) {
|
| | | private void VisitorFromViewHolder(EasyRecyclerViewHolder holder, final int posistion) {
|
| | | LinearLayout mLayout = holder.findViewById(R.id.item_visitor_from_base);
|
| | |
|
| | | TextView nameTv = (TextView)mLayout.findViewById(R.id.item_visitor_name);
|
| | | ImageView photoIv = (ImageView)mLayout.findViewById(R.id.item_visitor_photo);
|
| | |
|
| | | RelativeLayout itemVisitorFromRl = (RelativeLayout)mLayout.findViewById(R.id.item_visitor_from_rl);
|
| | |
|
| | | itemVisitorFromRl.setOnClickListener(new View.OnClickListener(){
|
| | | @Override
|
| | | public void onClick(View view) {
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof VisitorQueryItem) {
|
| | | VisitorQueryItem item = (VisitorQueryItem) data;
|
| | | VisitorRegisterFragment.getInstance().setVisitorInfo(item);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | nameTv.setText("");
|
| | |
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof VisitorQueryItem) {
|
| | | VisitorQueryItem item = (VisitorQueryItem) data;
|
| | | nameTv.setText(item.getName());
|
| | | }
|
| | |
|
| | |
|
| | | ViewGroup.LayoutParams layoutParams = mLayout.getLayoutParams();
|
| | | mLayout.setLayoutParams(layoutParams);
|
| | | }
|
| | |
| | | * @param holder
|
| | | * @param posistion
|
| | | */
|
| | | private void VisitorToViewHolder(EasyRecyclerViewHolder holder, int posistion) {
|
| | | private void VisitorToViewHolder(EasyRecyclerViewHolder holder, final int posistion) {
|
| | | mTvName = holder.findViewById(R.id.item_visitor_to_name);
|
| | |
|
| | | mToNameTv = (TextView) mTvName.findViewById(R.id.item_visitor_to_name);
|
| | | mToDepartmentTv = (TextView) mTvName.findViewById(R.id.item_visitor_to_department);
|
| | |
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof VisitorQueryItem) {
|
| | | VisitorQueryItem item = (VisitorQueryItem) data;
|
| | | mToNameTv.setText(item.getName());
|
| | | }
|
| | |
|
| | | RelativeLayout itemVisitorToRl = (RelativeLayout) holder.findViewById(R.id.item_visitor_to_rl);
|
| | | itemVisitorToRl.setOnClickListener(new View.OnClickListener(){
|
| | | @Override
|
| | | public void onClick(View view) {
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof VisitorQueryItem) {
|
| | | VisitorQueryItem item = (VisitorQueryItem) data;
|
| | | VisitorRegisterFragment.getInstance().setIntervieweeInfo(item);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | mTvDepartment = holder.findViewById(R.id.item_visitor_to_department);
|
| | | if (mTypeColor == TYPE_DEPARTMENT) {
|
| | | mTvName.setTextColor(mContext.getResources().getColor(R.color.colorText_b));
|