From 4b5518e231d939d024e6069f074eb38d7fd20f24 Mon Sep 17 00:00:00 2001 From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674> Date: 星期日, 23 七月 2017 11:51:41 +0800 Subject: [PATCH] --- VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/VisitorRegisterFragment.java | 44 +++++++++++++++++--------------------------- 1 files changed, 17 insertions(+), 27 deletions(-) diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/VisitorRegisterFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/VisitorRegisterFragment.java index c4186bd..04d51df 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/VisitorRegisterFragment.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/VisitorRegisterFragment.java @@ -168,7 +168,7 @@ return; } - OfflineVisitorRegisterItem offlineVisitorRegisterItem = new OfflineVisitorRegisterItem(); + Register offlineVisitorRegisterItem = new Register(); if (BaseApplication.getInstance().networkAvailable()) { params.addBodyParameter(Register.FieldNames.username, name); params.addBodyParameter(Register.FieldNames.mobilePhone, phone); @@ -199,9 +199,7 @@ if (fragment_visitor_register_surveillance_photo_img != null) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fragment_visitor_register_surveillance_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); - byte[] imageBytes = byteArrayOutputStream.toByteArray(); - - params.addBodyParameter("surveillancePhoto", FileUtil.writeToFile("surveillancePhoto", imageBytes)); + params.addBodyParameter("surveillancePhoto", FileUtil.writeToFile("surveillancePhoto", byteArrayOutputStream.toByteArray())); } else { params.addBodyParameter("surveillancePhoto", FileUtil.writeToFile("surveillancePhoto", new byte[]{})); } @@ -209,9 +207,7 @@ if (fragment_visitor_register_upload_custom_photo_img != null) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fragment_visitor_register_upload_custom_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); - byte[] imageBytes = byteArrayOutputStream.toByteArray(); - - params.addBodyParameter("uploadCustomPhoto", FileUtil.writeToFile("uploadCustomPhoto", imageBytes)); + params.addBodyParameter("uploadCustomPhoto", FileUtil.writeToFile("uploadCustomPhoto", byteArrayOutputStream.toByteArray())); } else { params.addBodyParameter("uploadCustomPhoto", FileUtil.writeToFile("uploadCustomPhoto", new byte[]{})); } @@ -219,9 +215,7 @@ if (fragment_visitor_register_id_card_photo_img != null) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fragment_visitor_register_id_card_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); - byte[] imageBytes = byteArrayOutputStream.toByteArray(); - - params.addBodyParameter("idCardPhoto", FileUtil.writeToFile("idCardPhoto", imageBytes)); + params.addBodyParameter("idCardPhoto", FileUtil.writeToFile("idCardPhoto", byteArrayOutputStream.toByteArray())); } else { params.addBodyParameter("idCardPhoto", FileUtil.writeToFile("idCardPhoto", new byte[]{})); } @@ -260,36 +254,30 @@ if (fragment_visitor_register_surveillance_photo_img != null) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fragment_visitor_register_surveillance_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); - byte[] imageBytes = byteArrayOutputStream.toByteArray(); - - surveillancePhotoBytes = imageBytes; + surveillancePhotoBytes = byteArrayOutputStream.toByteArray(); } FileUtil.writeToFile(surveillancePhotoPath, surveillancePhotoBytes); - offlineVisitorRegisterItem.setSurveillancePhotoPath(surveillancePhotoPath); + offlineVisitorRegisterItem.setSurveillancePhoto(surveillancePhotoPath); String uploadCustomPhotoPath = UUID.randomUUID().toString()+".bmp"; byte[] uploadCustomPhotoBytes = new byte[]{}; if (fragment_visitor_register_upload_custom_photo_img != null) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fragment_visitor_register_upload_custom_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); - byte[] imageBytes = byteArrayOutputStream.toByteArray(); - - uploadCustomPhotoBytes = imageBytes; + uploadCustomPhotoBytes = byteArrayOutputStream.toByteArray(); } FileUtil.writeToFile(uploadCustomPhotoPath, uploadCustomPhotoBytes); - offlineVisitorRegisterItem.setUploadCustomPhotoPath(uploadCustomPhotoPath); + offlineVisitorRegisterItem.setUploadCustomPhoto(uploadCustomPhotoPath); String idCardPhotoPath = UUID.randomUUID().toString()+".bmp"; byte[] idCardPhotoBytes = new byte[]{}; if (fragment_visitor_register_id_card_photo_img != null) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fragment_visitor_register_id_card_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); - byte[] imageBytes = byteArrayOutputStream.toByteArray(); - - idCardPhotoBytes = imageBytes; + idCardPhotoBytes = byteArrayOutputStream.toByteArray(); } FileUtil.writeToFile(idCardPhotoPath, idCardPhotoBytes); - offlineVisitorRegisterItem.setIdCardPhotoPath(idCardPhotoPath); + offlineVisitorRegisterItem.setIdCardPhoto(idCardPhotoPath); } RegisterMng.getInstance().add(params, idCardHeadPath, offlineVisitorRegisterItem); } @@ -447,11 +435,13 @@ //@OnClick(R.id.fragment_visitor_register_country) public void fragment_visitor_register_country_click(View view) { - new CountryDialog(fragment_visitor_register_linear_layout, new OkClickedListener() { - public void onSelected(String value) { - fragment_visitor_register_country.setValue(value); - } - },fragment_visitor_register_country.getValue()); + if (CountryDialog.hasCountries()) { + new CountryDialog(fragment_visitor_register_linear_layout, new OkClickedListener() { + public void onSelected(String value) { + fragment_visitor_register_country.setValue(value); + } + }, fragment_visitor_register_country.getValue()); + } } //@OnClick(R.id.fragment_visitor_register_gender) -- Gitblit v1.8.0