New file |
| | |
| | | package cn.com.basic.face.adapter;
|
| | |
|
| | | import android.content.Context;
|
| | | import android.net.Uri;
|
| | | import android.view.View;
|
| | | import android.view.ViewGroup;
|
| | | import android.widget.ImageView;
|
| | | 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 cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.query.item.FacePhotoItem;
|
| | | 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;
|
| | |
|
| | | public class SurveillanceFragment {
|
| | |
|
| | | public static class SurveillanceBottomListViewAdapter extends EasyRecyclerViewAdapter {
|
| | | private Context context;
|
| | | public SurveillanceBottomListViewAdapter(Context context) {
|
| | | this.context = context;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int[] getItemLayouts() {
|
| | | return new int[]{R.layout.fragment_surveillance_bottom_register_cell,R.layout.fragment_surveillance_bottom_visitor_cell, R.layout.fragment_surveillance_bottom_visit_blank_cell};
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onBindRecycleViewHolder(EasyRecyclerViewHolder viewHolder, int position) {
|
| | | switch (((SupervisoryQueryItem)getList().get(position)).getType()){
|
| | | case Constant.Supervisory.VISIT_REGISTER_ITEM_TYPE:
|
| | | RegisterCellViewFillData(viewHolder,position);
|
| | | break;
|
| | | case Constant.Supervisory.VISIT_CHECK_IN_ITEM_TYPE:
|
| | | checkInCellViewFillData(viewHolder,position);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getRecycleViewItemType(int position) {
|
| | | 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 RegisterCellViewFillData(EasyRecyclerViewHolder holder, int posistion){
|
| | |
|
| | | RelativeLayout mLayout = holder.findViewById(R.id.fragment_home_bottom_register_cell_relative_layout);
|
| | | ViewGroup.LayoutParams layoutParams = mLayout.getLayoutParams();
|
| | | layoutParams.height = WindowsUtil.dip2px(context, 127);
|
| | | layoutParams.width = WindowsUtil.dip2px(context, 104);
|
| | | mLayout.setLayoutParams(layoutParams);
|
| | |
|
| | | final Object data = this.getItem(posistion);
|
| | |
|
| | | 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 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);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 访客->来访登记
|
| | | */
|
| | | 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();
|
| | | layoutParams.height = WindowsUtil.dip2px(context, 127);
|
| | | layoutParams.width = WindowsUtil.dip2px(context, 104);
|
| | | mLayout.setLayoutParams(layoutParams);
|
| | |
|
| | | ImageView fragment_home_bottom_visitor_cell_photo = (ImageView) mLayout.findViewById(R.id.fragment_home_bottom_visitor_cell_photo);
|
| | | TextView fragment_home_bottom_visitor_cell_warning = (TextView) mLayout.findViewById(R.id.fragment_home_bottom_visitor_cell_warning);
|
| | | TextView fragment_home_bottom_visitor_cell_name = (TextView) mLayout.findViewById(R.id.fragment_home_bottom_visitor_cell_name);
|
| | | TextView fragment_home_bottom_visitor_cell_status = (TextView) mLayout.findViewById(R.id.fragment_home_bottom_visitor_cell_status);
|
| | | //statusTv.setText("");
|
| | |
|
| | | Object data = this.getItem(posistion);
|
| | | if (data instanceof FacePhotoItem) {
|
| | | final FacePhotoItem item = (FacePhotoItem) data;
|
| | |
|
| | | if (item.getWarning().length() > 0 && "来访登记".equals(item.getStatus())) {
|
| | | //warningTv.setText("警告");
|
| | | fragment_home_bottom_visitor_cell_warning.setVisibility(View.VISIBLE);
|
| | | } else {
|
| | | fragment_home_bottom_visitor_cell_warning.setVisibility(View.GONE);
|
| | | }
|
| | |
|
| | |
|
| | | fragment_home_bottom_visitor_cell_name.setText(item.getName());
|
| | |
|
| | | fragment_home_bottom_visitor_cell_status.setText(item.getStatus());
|
| | | if ("来访登记".equals(item.getStatus())) {
|
| | | fragment_home_bottom_visitor_cell_status.setBackground(context.getDrawable(R.drawable.rectangle_textview));
|
| | |
|
| | | fragment_home_bottom_visitor_cell_status.setHeight((int)(context.getResources().getDisplayMetrics().density * 45));
|
| | | fragment_home_bottom_visitor_cell_status.setOnClickListener(new View.OnClickListener(){
|
| | | @Override
|
| | | public void onClick(View view) {
|
| | | MainActivity.selectPage(2);
|
| | | }
|
| | | });
|
| | | } else {
|
| | | fragment_home_bottom_visitor_cell_status.setBackground(null);
|
| | | fragment_home_bottom_visitor_cell_status.setOnClickListener(null);
|
| | | }
|
| | | }
|
| | |
|
| | | fragment_home_bottom_visitor_cell_name.setText("");
|
| | | 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) {
|
| | | fragment_home_bottom_visitor_cell_status.setBackground(context.getDrawable(R.drawable.rectangle_textview));
|
| | |
|
| | | fragment_home_bottom_visitor_cell_status.setHeight((int)(context.getResources().getDisplayMetrics().density * 45));
|
| | | fragment_home_bottom_visitor_cell_status.setOnClickListener(new View.OnClickListener(){
|
| | | @Override
|
| | | public void onClick(View view) {
|
| | | MainActivity.selectPage(2);
|
| | | //CheckInFragment.getInstance().checkInFromHomePage(item);
|
| | | //CheckInFragment.getInstance().getFragment_check_in_right_visitor_cell().setVisitorInfo(item);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void setRowType(int i) {
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | }
|