| | |
| | | |
| | | import com.bsk.zhangbo.demoforbsk.R; |
| | | import cn.com.basic.face.base.MainActivity; |
| | | import cn.com.basic.face.fragment.CheckInFragment; |
| | | import cn.com.basic.face.fragment.RegisterFragment; |
| | | import cn.com.basic.face.discern.query.item.SupervisoryQueryItem; |
| | | import cn.com.basic.face.util.AppApi; |
| | | import cn.com.basic.face.util.Constant; |
| | | import cn.com.basic.face.util.WindowsUtil; |
| | | import com.camnter.easyrecyclerview.adapter.EasyRecyclerViewAdapter; |
| | | import com.camnter.easyrecyclerview.holder.EasyRecyclerViewHolder; |
| | | |
| | | import java.util.List; |
| | | |
| | | import cn.com.basic.face.discern.query.item.FacePhotoItem; |
| | | import cn.com.basic.face.discern.query.item.CheckInQueryItem; |
| | | |
| | | public class SupervisoryBottomListViewAdapter extends EasyRecyclerViewAdapter { |
| | | private int TYPE_1 = 0,TYPE_2 = 1; |
| | | private int type; |
| | | private Context context; |
| | | private List list; |
| | | public SupervisoryBottomListViewAdapter(Context context) { |
| | | this.context = context; |
| | | } |
| | | |
| | | @Override |
| | | public int[] getItemLayouts() { |
| | | return new int[]{R.layout.fragment_supervisory_bottom_register_cell,R.layout.fragment_supervisory_bottom_visitor_cell}; |
| | | return new int[]{R.layout.fragment_supervisory_bottom_register_cell,R.layout.fragment_supervisory_bottom_visitor_cell, R.layout.fragment_supervisory_bottom_visit_blank_cell}; |
| | | } |
| | | |
| | | @Override |
| | | public void onBindRecycleViewHolder(EasyRecyclerViewHolder viewHolder, int position) { |
| | | int recycleViewItemType = getRecycleViewItemType(position); |
| | | switch (recycleViewItemType){ |
| | | case 0: |
| | | RegisterViewHolder(viewHolder,position); |
| | | switch (((SupervisoryQueryItem)getList().get(position)).getType()){ |
| | | case Constant.Supervisory.VISIT_REGISTER_ITEM_TYPE: |
| | | RegisterCellViewFillData(viewHolder,position); |
| | | break; |
| | | case 1: |
| | | UserViewHolder(viewHolder,position); |
| | | case Constant.Supervisory.VISIT_CHECK_IN_ITEM_TYPE: |
| | | checkInCellViewFillData(viewHolder,position); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int getRecycleViewItemType(int position) { |
| | | |
| | | type = position%2; |
| | | switch (type){ |
| | | case 0: |
| | | return TYPE_1; |
| | | case 1: |
| | | return TYPE_2; |
| | | default: |
| | | return TYPE_1; |
| | | switch (((SupervisoryQueryItem)getList().get(position)).getType()) { |
| | | case Constant.Supervisory.VISIT_REGISTER_ITEM_TYPE: |
| | | return Constant.Supervisory.REGISTER_CELL_VIEW_INDEX; |
| | | case Constant.Supervisory.VISIT_CHECK_IN_ITEM_TYPE: |
| | | return Constant.Supervisory.CHECK_IN_CELL_VIEW_INDEX; |
| | | case Constant.Supervisory.VISIT_BLANK_ITEM_TYPE: |
| | | return Constant.Supervisory.VISIT_BLANK_CELL_VIEW_INDEX; |
| | | } |
| | | return Constant.Supervisory.VISIT_BLANK_CELL_VIEW_INDEX; |
| | | } |
| | | |
| | | /** |
| | | * 访客->人员注册 |
| | | */ |
| | | private void RegisterViewHolder(EasyRecyclerViewHolder holder,int posistion){ |
| | | private void RegisterCellViewFillData(EasyRecyclerViewHolder holder, int posistion){ |
| | | |
| | | RelativeLayout mLayout = holder.findViewById(R.id.fragment_home_bottom_register_cell_relative_layout); |
| | | ViewGroup.LayoutParams layoutParams = mLayout.getLayoutParams(); |
| | |
| | | ImageView fragment_home_bottom_register_cell_photo = holder.findViewById(R.id.fragment_home_bottom_register_cell_photo); |
| | | TextView fragment_home_bottom_register_cell_to_register = holder.findViewById(R.id.fragment_home_bottom_register_cell_to_register); |
| | | |
| | | if (data instanceof CheckInQueryItem) { |
| | | final CheckInQueryItem item = (CheckInQueryItem)data; |
| | | if (data instanceof SupervisoryQueryItem) { |
| | | final SupervisoryQueryItem item = (SupervisoryQueryItem)data; |
| | | fragment_home_bottom_register_cell_photo.setImageURI(Uri.parse(AppApi.IMAGEURL_BASE +item.getImagePath())); |
| | | fragment_home_bottom_register_cell_to_register.setOnClickListener(new View.OnClickListener(){ |
| | | @Override |
| | | public void onClick(View view) { |
| | | MainActivity.selectPage(1); |
| | | RegisterFragment.getInstance().setRegisterInfo(item); |
| | | //RegisterFragment.getInstance().setRegisterInfo(item); |
| | | } |
| | | }); |
| | | } |
| | |
| | | /** |
| | | * 访客->来访登记 |
| | | */ |
| | | private void UserViewHolder(EasyRecyclerViewHolder holder,int posistion){ |
| | | private void checkInCellViewFillData(EasyRecyclerViewHolder holder, int posistion){ |
| | | |
| | | RelativeLayout mLayout = holder.findViewById(R.id.fragment_supervisory_bottom_visitor_cell_relative_layout); |
| | | ViewGroup.LayoutParams layoutParams = mLayout.getLayoutParams(); |
| | |
| | | } |
| | | |
| | | fragment_home_bottom_visitor_cell_name.setText(""); |
| | | if (data instanceof CheckInQueryItem) { |
| | | final CheckInQueryItem item = (CheckInQueryItem)data; |
| | | if (data instanceof SupervisoryQueryItem) { |
| | | final SupervisoryQueryItem item = (SupervisoryQueryItem)data; |
| | | fragment_home_bottom_visitor_cell_name.setText(item.getName()); |
| | | fragment_home_bottom_visitor_cell_photo.setImageURI(Uri.parse(AppApi.IMAGEURL_BASE +item.getImagePath())); |
| | | if (1==1) { |
| | |
| | | @Override |
| | | public void onClick(View view) { |
| | | MainActivity.selectPage(2); |
| | | CheckInFragment.getInstance().checkInFromHomePage(item); |
| | | CheckInFragment.getInstance().getFragment_check_in_right_visitor_cell().setVisitorInfo(item); |
| | | //CheckInFragment.getInstance().checkInFromHomePage(item); |
| | | //CheckInFragment.getInstance().getFragment_check_in_right_visitor_cell().setVisitorInfo(item); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public void setRowType(int i) { |
| | | |