From b96e8c8ba2bc11461d1ea6c80a167392ef09cb8a Mon Sep 17 00:00:00 2001
From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期一, 24 四月 2017 15:11:27 +0800
Subject: [PATCH] 

---
 VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java |  156 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 87 insertions(+), 69 deletions(-)

diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java
index a538fa5..0065850 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java
@@ -19,6 +19,7 @@
 import cn.com.basic.face.discern.query.item.CheckInQueryItem;
 import cn.com.basic.face.service.DictionaryMng;
 import cn.com.basic.face.service.RegisterMng;
+import cn.com.basic.face.service.SurveillanceMng;
 import cn.com.basic.face.util.Constant;
 import cn.com.basic.face.util.OkClickedListener;
 
@@ -38,7 +39,9 @@
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 import cn.com.basic.face.base.MainActivity;
 
@@ -112,74 +115,74 @@
     public void fragment_register_add_click(View v) {
         RequestParams params = new RequestParams();
 
-//        String name = fragment_register_name.getValue();
-//        if (name.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "濮撳悕涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_name.requestFocus();
-//            return;
-//        }
-//        String phone = fragment_register_phone.getValue();
-//        if (phone.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "鐢佃瘽涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_phone.requestFocus();
-//            return;
-//        }
-//        String gender = fragment_register_gender.getValue();
-//        if (gender.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "鎬у埆涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_gender.callOnClick();
-//            return;
-//        }
-//        String id_class = fragment_register_id_class.getValue();
-//        if (id_class.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "璇佷欢绫诲瀷涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_id_class.callOnClick();
-//            return;
-//        }
-//        String country = fragment_register_country.getValue();
-//        if (country.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "鍥界睄涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_country.callOnClick();
-//            return;
-//        }
-//        String id_num = fragment_register_id_num.getValue();
-//        if (id_num.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "璇佷欢缂栧彿涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_id_num.requestFocus();
-//            return;
-//        }
-//        String birthday = fragment_register_birthday.getValue();
-//        if (birthday.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "鍑虹敓鏃ユ湡涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_birthday.callOnClick();
-//            return;
-//        }
-//        String company = fragment_register_company.getValue();
-//        if (company.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "鍏徃鍚嶇О涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_company.requestFocus();
-//            return;
-//        }
-//        String remark = fragment_register_remark.getValue();
-//        if (remark.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "澶囨敞涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_remark.requestFocus();
-//            return;
-//        }
-//        String visitor_class = fragment_register_visitor_class.getValue();
-//        if (visitor_class.trim().length() <= 0) {
-//            Toast.makeText(MainActivity.getInstance(), "璁垮绫诲瀷涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-//            fragment_register_visitor_class.callOnClick();
-//            return;
-//        }
-//        params.addBodyParameter(Register.FieldNames.username, name);
-//        params.addBodyParameter(Register.FieldNames.mobilePhone, phone);
-//        params.addBodyParameter(Register.FieldNames.genderId, DictionaryMng.getInstance().getId(gender));
-//        params.addBodyParameter(Register.FieldNames.identityTypeId, DictionaryMng.getInstance().getId(id_class));
-//        params.addBodyParameter(Register.FieldNames.countryId, DictionaryMng.getInstance().getId(country));
-//        params.addBodyParameter(Register.FieldNames.identifyNum, id_num);
-//        params.addBodyParameter(Register.FieldNames.companyId, company);
-//        params.addBodyParameter(Register.FieldNames.birthday, birthday);
+        String name = fragment_register_name.getValue();
+        if (name.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "濮撳悕涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_name.requestFocus();
+            return;
+        }
+        String phone = fragment_register_phone.getValue();
+        if (phone.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "鐢佃瘽涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_phone.requestFocus();
+            return;
+        }
+        String gender = fragment_register_gender.getValue();
+        if (gender.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "鎬у埆涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_gender.callOnClick();
+            return;
+        }
+        String id_class = fragment_register_id_class.getValue();
+        if (id_class.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "璇佷欢绫诲瀷涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_id_class.callOnClick();
+            return;
+        }
+        String country = fragment_register_country.getValue();
+        if (country.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "鍥界睄涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_country.callOnClick();
+            return;
+        }
+        String id_num = fragment_register_id_num.getValue();
+        if (id_num.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "璇佷欢缂栧彿涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_id_num.requestFocus();
+            return;
+        }
+        String birthday = fragment_register_birthday.getValue();
+        if (birthday.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "鍑虹敓鏃ユ湡涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_birthday.callOnClick();
+            return;
+        }
+        String company = fragment_register_company.getValue();
+        if (company.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "鍏徃鍚嶇О涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_company.requestFocus();
+            return;
+        }
+        String remark = fragment_register_remark.getValue();
+        if (remark.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "澶囨敞涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_remark.requestFocus();
+            return;
+        }
+        String visitor_class = fragment_register_visitor_class.getValue();
+        if (visitor_class.trim().length() <= 0) {
+            Toast.makeText(MainActivity.getInstance(), "璁垮绫诲瀷涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
+            fragment_register_visitor_class.callOnClick();
+            return;
+        }
+        params.addBodyParameter(Register.FieldNames.username, name);
+        params.addBodyParameter(Register.FieldNames.mobilePhone, phone);
+        params.addBodyParameter(Register.FieldNames.genderId, DictionaryMng.getInstance().getId(gender));
+        params.addBodyParameter(Register.FieldNames.identityTypeId, DictionaryMng.getInstance().getId(id_class));
+        params.addBodyParameter(Register.FieldNames.countryId, DictionaryMng.getInstance().getId(country));
+        params.addBodyParameter(Register.FieldNames.identifyNum, id_num);
+        params.addBodyParameter(Register.FieldNames.companyId, company);
+        params.addBodyParameter(Register.FieldNames.birthday, birthday);
 
         if (fragment_register_choose_photo_img != null) {
             ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
@@ -234,6 +237,11 @@
 
                 fragment_register_update_photo_placeholder_image.setVisibility(View.INVISIBLE);
                 fragment_register_update_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
+
+                List<Bitmap> bitmapList = new ArrayList<>();
+                bitmapList.add(0, bitmap);
+
+                SurveillanceMng.getInstance().addBitmap(bitmapList, null, 0);
 
             } catch (Exception e) {
                 e.printStackTrace();
@@ -347,7 +355,17 @@
     public void onClick(View v) {}
 
     public void setRegisterInfo(CheckInQueryItem item) {
-        fragment_register_choose_photo.setImageURI(Uri.parse(AppApi.IMAGE_URL_BASE + item.getImagePath()));
+        fragment_register_choose_photo.setImageURI(Uri.parse(AppApi.IMAGE_URL_BASE + item.getSurveillancePhoto()));
+    }
+
+    public ImageView get_fragment_register_choose_photo() {
+        return fragment_register_choose_photo;
+    }
+
+    public void setChoosePhoto(Bitmap bitmap) {
+        fragment_register_choose_photo.setImageBitmap(bitmap);
+        fragment_register_choose_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
+        fragment_register_choose_photo_placeholder_image.setVisibility(View.INVISIBLE);
     }
 
 }

--
Gitblit v1.8.0