New file |
| | |
| | | package cn.com.basic.face.adapter;
|
| | |
|
| | | import android.content.Context;
|
| | | import android.net.Uri;
|
| | | import android.view.View;
|
| | | import android.widget.LinearLayout;
|
| | | import android.widget.RelativeLayout;
|
| | | import android.widget.TextView;
|
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import com.camnter.easyrecyclerview.adapter.EasyRecyclerViewAdapter;
|
| | | import com.camnter.easyrecyclerview.holder.EasyRecyclerViewHolder;
|
| | | import com.facebook.drawee.view.SimpleDraweeView;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.discern.query.item.CheckInQueryItem;
|
| | | import cn.com.basic.face.util.AppApi;
|
| | | import cn.com.basic.face.util.Constant;
|
| | |
|
| | | public class CheckInFragment {
|
| | |
|
| | | public static class CheckInLeftListViewAdapter extends EasyRecyclerViewAdapter {
|
| | | private Context mContext;
|
| | | private int type, mTypeColor;
|
| | | private List list;
|
| | | private TextView fragment_check_in_left_interviewee_row_name;
|
| | | private TextView fragment_check_in_left_interviewee_row_dept;
|
| | | private SimpleDraweeView fragment_check_in_left_interviewee_row_photo;
|
| | | public static final int TYPE_NAME = 10000;
|
| | | public static final int TYPE_DEPARTMENT = 10001;
|
| | |
|
| | | public CheckInLeftListViewAdapter(Context mContext, int type) {
|
| | | this.mContext = mContext;
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public CheckInLeftListViewAdapter(Context mContext) {
|
| | | this.mContext = mContext;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int[] getItemLayouts() {
|
| | | return new int[]{R.layout.fragment_check_in_left_visitor_row, R.layout.fragment_check_in_left_interviewee_row};
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onBindRecycleViewHolder(EasyRecyclerViewHolder viewHolder, int position) {
|
| | | switch (type) {
|
| | | case Constant.CheckIn.VISITOR_ROW:
|
| | | visitorCellHolder(viewHolder, position);
|
| | | break;
|
| | | case Constant.CheckIn.INTERVIEWEE_ROW:
|
| | | intervieweeCellHolder(viewHolder, position);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getRecycleViewItemType(int position) {
|
| | | switch (type) {
|
| | | case Constant.CheckIn.VISITOR_ROW:
|
| | | return 0;
|
| | | case Constant.CheckIn.INTERVIEWEE_ROW:
|
| | | return 1;
|
| | | default:
|
| | | return 1;
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 来访人Holder
|
| | | *
|
| | | * @param holder
|
| | | * @param posistion
|
| | | */
|
| | | private void visitorCellHolder(EasyRecyclerViewHolder holder, final int posistion) {
|
| | | LinearLayout fragment_check_in_left_visitor_row_linear_layout = holder.findViewById(R.id.fragment_check_in_left_visitor_row_linear_layout);
|
| | |
|
| | | TextView fragment_check_in_left_visitor_row_name = (TextView)fragment_check_in_left_visitor_row_linear_layout.findViewById(R.id.fragment_check_in_left_visitor_row_name);
|
| | | SimpleDraweeView fragment_check_in_left_visitor_row_photo = (SimpleDraweeView) fragment_check_in_left_visitor_row_linear_layout.findViewById(R.id.fragment_check_in_left_visitor_row_photo);
|
| | |
|
| | | RelativeLayout fragment_check_in_left_visitor_row_relative_layout = (RelativeLayout)fragment_check_in_left_visitor_row_linear_layout.findViewById(R.id.fragment_check_in_left_visitor_row_relative_layout);
|
| | |
|
| | | fragment_check_in_left_visitor_row_relative_layout.setOnClickListener(new View.OnClickListener(){
|
| | | @Override
|
| | | public void onClick(View view) {
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof CheckInQueryItem) {
|
| | | CheckInQueryItem item = (CheckInQueryItem) data;
|
| | | cn.com.basic.face.fragment.CheckInFragment.getInstance().getFragment_check_in_right_visitor_cell().setVisitorInfo(item);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | fragment_check_in_left_visitor_row_name.setText("");
|
| | |
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof CheckInQueryItem) {
|
| | | CheckInQueryItem item = (CheckInQueryItem) data;
|
| | | fragment_check_in_left_visitor_row_name.setText(item.getName());
|
| | | fragment_check_in_left_visitor_row_photo.setImageURI(Uri.parse(AppApi.IMAGEURL_BASE + item.getImagePath()));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 被访问Holder
|
| | | *
|
| | | * @param holder
|
| | | * @param posistion
|
| | | */
|
| | | private void intervieweeCellHolder(EasyRecyclerViewHolder holder, final int posistion) {
|
| | | fragment_check_in_left_interviewee_row_name = holder.findViewById(R.id.fragment_check_in_left_interviewee_row_name);
|
| | | fragment_check_in_left_interviewee_row_dept = holder.findViewById(R.id.fragment_check_in_left_interviewee_row_dept);
|
| | | fragment_check_in_left_interviewee_row_photo = holder.findViewById(R.id.fragment_check_in_left_interviewee_row_photo);
|
| | |
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof CheckInQueryItem) {
|
| | | CheckInQueryItem item = (CheckInQueryItem) data;
|
| | | fragment_check_in_left_interviewee_row_name.setText(item.getName());
|
| | | fragment_check_in_left_interviewee_row_dept.setText(item.getDeptName());
|
| | | fragment_check_in_left_interviewee_row_photo.setImageURI(Uri.parse(AppApi.IMAGEURL_BASE + item.getImagePath()));
|
| | | }
|
| | |
|
| | | holder.findViewById(R.id.fragment_check_in_left_interviewee_row_relativeLayout).setOnClickListener(new View.OnClickListener(){
|
| | | @Override
|
| | | public void onClick(View view) {
|
| | | Object data = getList().get(posistion);
|
| | | if (data instanceof CheckInQueryItem) {
|
| | | CheckInQueryItem item = (CheckInQueryItem) data;
|
| | | cn.com.basic.face.fragment.CheckInFragment.getInstance().getFragment_check_in_right_interviewee_cell().setIntervieweeInfo(item);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | if (mTypeColor == TYPE_DEPARTMENT) {
|
| | | fragment_check_in_left_interviewee_row_name.setTextColor(mContext.getResources().getColor(R.color.colorText_b));
|
| | | fragment_check_in_left_interviewee_row_dept.setTextColor(mContext.getResources().getColor(R.color.colorText_5));
|
| | | } else {
|
| | | fragment_check_in_left_interviewee_row_name.setTextColor(mContext.getResources().getColor(R.color.colorText_5));
|
| | | fragment_check_in_left_interviewee_row_dept.setTextColor(mContext.getResources().getColor(R.color.colorText_b));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void set_fragment_check_in_left_sort_radio_group_type(int type) {
|
| | | this.mTypeColor = type;
|
| | | }
|
| | |
|
| | | public void setVisitorRow() {
|
| | | this.type = Constant.CheckIn.VISITOR_ROW;
|
| | | }
|
| | |
|
| | | public void setIntervieweeRow() {
|
| | | this.type = Constant.CheckIn.INTERVIEWEE_ROW;
|
| | | }
|
| | |
|
| | | public void setRowType(int type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|