| | |
| | | import cn.com.basic.face.service.SurveillanceMng;
|
| | | import cn.com.basic.face.util.BitmapUtil;
|
| | | import cn.com.basic.face.util.Constant;
|
| | | import cn.com.basic.face.util.FileUtil;
|
| | | import cn.com.basic.face.util.NativeImg;
|
| | | import cn.com.basic.face.util.OkClickedListener;
|
| | |
|
| | |
| | | import cn.com.basic.face.widget.register.RegisterRightFieldTextView;
|
| | | import cn.com.basic.face.dialog.SelectDialog;
|
| | |
|
| | | import com.facebook.common.file.FileUtils;
|
| | | import com.ivsign.android.IDCReader.IDCReaderSDK;
|
| | | import com.lidroid.xutils.view.annotation.ViewInject;
|
| | | import com.lidroid.xutils.view.annotation.event.OnClick;
|
| | |
|
| | | import org.xutils.common.util.FileUtil;
|
| | | import org.xutils.common.util.IOUtil;
|
| | | import org.xutils.http.RequestParams;
|
| | |
|
| | | import java.io.BufferedOutputStream;
|
| | |
| | | resetForm();
|
| | | }
|
| | |
|
| | | private File writeToFile(String fileName, byte[] fileBytes) {
|
| | | try {
|
| | | String dir = MainActivity.getInstance().getFilesDir().getAbsolutePath();
|
| | |
|
| | | File file = new File(dir, fileName);
|
| | | if (file.exists()) {
|
| | | file.delete();
|
| | | }
|
| | | file.createNewFile();
|
| | | BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(dir, fileName)));
|
| | | bos.write(fileBytes);
|
| | | bos.flush();
|
| | | bos.close();
|
| | | return new File(dir, fileName);
|
| | | }catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | @OnClick(R.id.fragment_register_save)
|
| | | public void fragment_register_save_click(View v) {
|
| | | RequestParams params = new RequestParams();
|
| | |
| | | for (int i = 0; i < nativeImg.size; i++) {
|
| | | imageBytes[i] = nativeImg.image[i];
|
| | | }
|
| | |
|
| | | params.addBodyParameter("rawSurveillancePhoto", writeToFile("rawSurveillancePhoto", imageBytes));
|
| | | params.addBodyParameter("rawSurveillancePhoto", FileUtil.writeToFile("rawSurveillancePhoto", imageBytes));
|
| | | } else {
|
| | | params.addBodyParameter("rawSurveillancePhoto", writeToFile("rawSurveillancePhoto", new byte[]{}));
|
| | | params.addBodyParameter("rawSurveillancePhoto", FileUtil.writeToFile("rawSurveillancePhoto", new byte[]{}));
|
| | | }
|
| | |
|
| | | if (fragment_register_surveillance_photo_img != null) {
|
| | |
| | | fragment_register_surveillance_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
|
| | | byte[] imageBytes = byteArrayOutputStream.toByteArray();
|
| | |
|
| | | params.addBodyParameter("surveillancePhoto", writeToFile("surveillancePhoto", imageBytes));
|
| | | params.addBodyParameter("surveillancePhoto", FileUtil.writeToFile("surveillancePhoto", imageBytes));
|
| | | } else {
|
| | | params.addBodyParameter("surveillancePhoto", writeToFile("surveillancePhoto", new byte[]{}));
|
| | | params.addBodyParameter("surveillancePhoto", FileUtil.writeToFile("surveillancePhoto", new byte[]{}));
|
| | | }
|
| | |
|
| | | if (fragment_register_upload_custom_photo_img != null) {
|
| | |
| | | fragment_register_upload_custom_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
|
| | | byte[] imageBytes = byteArrayOutputStream.toByteArray();
|
| | |
|
| | | params.addBodyParameter("uploadCustomPhoto", writeToFile("uploadCustomPhoto", imageBytes));
|
| | | params.addBodyParameter("uploadCustomPhoto", FileUtil.writeToFile("uploadCustomPhoto", imageBytes));
|
| | | } else {
|
| | | params.addBodyParameter("uploadCustomPhoto", writeToFile("uploadCustomPhoto", new byte[]{}));
|
| | | params.addBodyParameter("uploadCustomPhoto", FileUtil.writeToFile("uploadCustomPhoto", new byte[]{}));
|
| | | }
|
| | |
|
| | | if (fragment_register_id_card_photo_img != null) {
|
| | |
| | | fragment_register_id_card_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
|
| | | byte[] imageBytes = byteArrayOutputStream.toByteArray();
|
| | |
|
| | | params.addBodyParameter("idCardPhoto", writeToFile("idCardPhoto", imageBytes));
|
| | | params.addBodyParameter("idCardPhoto", FileUtil.writeToFile("idCardPhoto", imageBytes));
|
| | | } else {
|
| | | params.addBodyParameter("idCardPhoto", writeToFile("idCardPhoto", new byte[]{}));
|
| | | params.addBodyParameter("idCardPhoto", FileUtil.writeToFile("idCardPhoto", new byte[]{}));
|
| | | }
|
| | | RegisterMng.getInstance().add(params, idCardHeadPhotoPath);
|
| | | }
|