From b7fd23fb1b9d04eb8fa0d97a5d9747e145605612 Mon Sep 17 00:00:00 2001
From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期三, 03 五月 2017 14:33:42 +0800
Subject: [PATCH] 

---
 VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/SurveillanceFragment.java |   72 +++++++++++++++++++++++++++++++----
 1 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/SurveillanceFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/SurveillanceFragment.java
index 746d8de..db65956 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/SurveillanceFragment.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/SurveillanceFragment.java
@@ -18,14 +18,15 @@
 import cn.com.basic.face.discern.query.item.SurveillanceQueryItem;
 import cn.com.basic.face.fragment.*;
 import cn.com.basic.face.util.AppApi;
+import cn.com.basic.face.util.BitmapUtil;
 import cn.com.basic.face.util.Constant;
 import cn.com.basic.face.util.WindowsUtil;
 
 public class SurveillanceFragment {
 
-    public static class SurveillanceBottomListViewAdapter extends EasyRecyclerViewAdapter {
+    public static class SurveillanceBottomVisitorListViewAdapter extends EasyRecyclerViewAdapter {
         private Context context;
-        public SurveillanceBottomListViewAdapter(Context context) {
+        public SurveillanceBottomVisitorListViewAdapter(Context context) {
             this.context = context;
         }
 
@@ -66,8 +67,8 @@
 
             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);
+            layoutParams.height = (int)MainActivity.getInstance().getResources().getDimension(R.dimen.h127dp);//WindowsUtil.dip2px(context, 127);
+            layoutParams.width = (int)MainActivity.getInstance().getResources().getDimension(R.dimen.h122dp);//WindowsUtil.dip2px(context, 122);
             mLayout.setLayoutParams(layoutParams);
 
             final Object data = this.getItem(position);
@@ -92,10 +93,11 @@
                     @Override
                     public void onClick(View view) {
                         MainActivity.selectPage(1);
-                        RegisterFragment.getInstance().setRegisterInfo(getVo(item));
-                        if(item.getBitmap() != null) {
-                            RegisterFragment.getInstance().setChoosePhoto(item.getBitmap());
-                        }
+                        //RegisterFragment.getInstance().setRegisterInfo(getVo(item));//java.lang.OutOfMemoryError: Failed to allocate a 25338980 byte allocation with 15827186 free bytes and 15MB until OOM
+                        //if(item.getBitmap() != null) {
+                        //    RegisterFragment.getInstance().setChoosePhoto(item.getBitmap());
+                        //    RegisterFragment.getInstance().setSurveillanceQueryItem(item);
+                        //}
                     }
                 });
             }
@@ -109,7 +111,7 @@
             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);
+            layoutParams.width = WindowsUtil.dip2px(context, 122);
             mLayout.setLayoutParams(layoutParams);
 
             ImageView fragment_home_bottom_visitor_cell_photo = (ImageView) mLayout.findViewById(R.id.fragment_home_bottom_visitor_cell_photo);
@@ -199,4 +201,56 @@
         }
     }
 
+    public static class SurveillanceBottomAttendanceListViewAdapter extends EasyRecyclerViewAdapter {
+        private Context context;
+        public SurveillanceBottomAttendanceListViewAdapter(Context context) {
+            this.context = context;
+        }
+
+        @Override
+        public int[] getItemLayouts() {
+            return new int[]{R.layout.fragment_surveillance_bottom_attendance_cell, R.layout.fragment_surveillance_bottom_attendance_blank_cell};
+        }
+
+        @Override
+        public void onBindRecycleViewHolder(EasyRecyclerViewHolder viewHolder, int position) {
+            RelativeLayout mLayout = viewHolder.findViewById(R.id.fragment_supervisory_bottom_attendance_cell_relative_layout);
+            ViewGroup.LayoutParams layoutParams = mLayout.getLayoutParams();
+            layoutParams.height = WindowsUtil.dip2px(context, 127);
+            layoutParams.width = WindowsUtil.dip2px(context, 122);
+            mLayout.setLayoutParams(layoutParams);
+
+            ImageView fragment_home_bottom_attendance_cell_photo = (ImageView) mLayout.findViewById(R.id.fragment_home_bottom_attendance_cell_photo);
+            TextView fragment_home_bottom_attendance_cell_name = (TextView) mLayout.findViewById(R.id.fragment_home_bottom_attendance_cell_name);
+            TextView fragment_home_bottom_attendance_cell_status = (TextView) mLayout.findViewById(R.id.fragment_home_bottom_attendance_cell_status);
+
+            Object data = this.getItem(position);
+
+            fragment_home_bottom_attendance_cell_name.setText("");
+            if (data instanceof SurveillanceQueryItem) {
+                final SurveillanceQueryItem item = (SurveillanceQueryItem)data;
+                fragment_home_bottom_attendance_cell_name.setText(item.getUsername());
+
+                if (item.getImagePath() != null && !item.getImagePath().equals("")) {
+                    fragment_home_bottom_attendance_cell_photo.setImageURI(Uri.parse(AppApi.IMAGE_URL_BASE +item.getImagePath()));
+                } else {
+                    if (item.getBitmap() != null) {
+                        fragment_home_bottom_attendance_cell_photo.setImageBitmap(item.getBitmap());
+                    } else {
+                        fragment_home_bottom_attendance_cell_photo.setImageResource(R.drawable.u45);
+                    }
+                }
+                fragment_home_bottom_attendance_cell_status.setText(item.getStatus());
+            }
+        }
+
+        @Override
+        public int getRecycleViewItemType(int position) {
+            return 0;
+        }
+
+        private CheckInQueryItem getVo(SurveillanceQueryItem item) {
+            return JSON.parseObject(JSON.toJSONString(item), CheckInQueryItem.class);
+        }
+    }
 }

--
Gitblit v1.8.0